WebView Downloader: fix edit box hotkeys, fix appearance.

Not yet fixed download stuck.

git-svn-id: svn://kolibrios.org@6969 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2017-09-10 05:38:29 +00:00
parent a1a44f3b0e
commit d92792638e
3 changed files with 23 additions and 19 deletions

View File

@ -5,7 +5,7 @@
#define SHOW_IN_FOLDER "<22>®ª § âì ¢ ¯ ¯ª¥" #define SHOW_IN_FOLDER "<22>®ª § âì ¢ ¯ ¯ª¥"
#define OPEN_FILE_TEXT "Žâªàëâì ä ©«" #define OPEN_FILE_TEXT "Žâªàëâì ä ©«"
#define FILE_SAVED_AS "'Œ¥­¥¤¦¥à § £à㧮ª\n” ©« á®åà ­¥­ ª ª " #define FILE_SAVED_AS "'Œ¥­¥¤¦¥à § £à㧮ª\n” ©« á®åà ­¥­ ª ª "
#define KB_RECEIVED " ¯®«ã祭®" #define KB_RECEIVED "ế乒 嶊删芍<E588A0>言... %s 祚怒蟡陋"
#else #else
#define DL_WINDOW_HEADER "Download Manager" #define DL_WINDOW_HEADER "Download Manager"
#define START_DOWNLOADING "Start downloading" #define START_DOWNLOADING "Start downloading"
@ -13,7 +13,7 @@
#define SHOW_IN_FOLDER "Show in folder" #define SHOW_IN_FOLDER "Show in folder"
#define OPEN_FILE_TEXT "Open file" #define OPEN_FILE_TEXT "Open file"
#define FILE_SAVED_AS "'Download manager\nFile saved as " #define FILE_SAVED_AS "'Download manager\nFile saved as "
#define KB_RECEIVED " received" #define KB_RECEIVED "Downloading... %s received"
#endif #endif
char save_to[4096] = "/tmp0/1/Downloads"; char save_to[4096] = "/tmp0/1/Downloads";
@ -22,7 +22,10 @@ char downloader_edit[10000];
char filepath[4096]; char filepath[4096];
int mouse_twbi; int mouse_twbi;
edit_box ed = {250,20,20,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,sizeof(downloader_edit),#downloader_edit,#mouse_twbi,2,19,19}; edit_box ed = {250,20,20,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,sizeof(downloader_edit),#downloader_edit,#mouse_twbi,2,19,19};
progress_bar pb = {0, 200, 55, 225, 12, 0, 0, 100, 0xFFFfff, 0x74DA00, 0x9F9F9F}; progress_bar pb = {0, 20, 58, 350, 17, 0, 0, 100, 0xFFFfff, 0x74DA00, 0x9F9F9F};
//progress_bar pb = {0, 180, 55, 225, 12, 0, 0, 100, 0xFFFfff, 0x74DA00, 0x9F9F9F};
//progress_bar: value, left, top, width, height, style, min, max, back_color, progress_color, frame_color;
byte downloader_opened; byte downloader_opened;
char downloader_stak[4096]; char downloader_stak[4096];
@ -38,6 +41,9 @@ void Downloader()
downloader_opened = 1; downloader_opened = 1;
SetEventMask(0x27); SetEventMask(0x27);
system.color.get();
pb.frame_color = system.color.work_dark;
filepath[0] = NULL; filepath[0] = NULL;
downloader.Stop(); downloader.Stop();
@ -60,14 +66,12 @@ void Downloader()
case evKey: case evKey:
GetKeys(); GetKeys();
EAX = key_ascii << 8;
edit_box_key stdcall(#ed); edit_box_key stdcall(#ed);
if (key_scancode==SCAN_CODE_ENTER) Key_Scan(301); if (key_scancode==SCAN_CODE_ENTER) Key_Scan(301);
break; break;
case evReDraw: case evReDraw:
system.color.get(); DefineAndDrawWindow(215, 100, 580, 130, 0x74, system.color.work, DL_WINDOW_HEADER, 0);
DefineAndDrawWindow(215, 100, 580, 120, 0x74, system.color.work, DL_WINDOW_HEADER, 0);
GetProcessInfo(#DL_Form, SelfInfo); GetProcessInfo(#DL_Form, SelfInfo);
if (DL_Form.status_window>2) break; if (DL_Form.status_window>2) break;
if (DL_Form.height<120) MoveSize(OLD,OLD,OLD,120); if (DL_Form.height<120) MoveSize(OLD,OLD,OLD,120);
@ -125,23 +129,24 @@ void DL_Draw_Window()
{ {
int cleft = 15; int cleft = 15;
int but_x = 0; int but_x = 0;
int but_y = 58;
DrawBar(0,0, DL_Form.cwidth, DL_Form.cheight, system.color.work); DrawBar(0,0, DL_Form.cwidth, DL_Form.cheight, system.color.work);
DeleteButton(305); DeleteButton(305);
DeleteButton(306); DeleteButton(306);
if (downloader.state == STATE_NOT_STARTED) || (downloader.state == STATE_COMPLETED) if (downloader.state == STATE_NOT_STARTED) || (downloader.state == STATE_COMPLETED)
{ {
but_x = cleft + DrawStandartCaptButton(cleft, 55, 301, START_DOWNLOADING); but_x = cleft + DrawStandartCaptButton(cleft, but_y, 301, START_DOWNLOADING);
if (filepath[0])
{
but_x += DrawStandartCaptButton(but_x, but_y, 305, SHOW_IN_FOLDER);
DrawStandartCaptButton(but_x, but_y, 306, OPEN_FILE_TEXT);
}
} }
if (downloader.state == STATE_IN_PROGRESS) if (downloader.state == STATE_IN_PROGRESS)
{ {
DrawStandartCaptButton(cleft, 55, 302, STOP_DOWNLOADING); DrawCaptButton(DL_Form.width - 190, but_y, 167, 26, 302, system.color.work_button, system.color.work_button_text, STOP_DOWNLOADING);
DrawDownloading(); DrawDownloading();
} }
if (filepath[0])
{
but_x += DrawStandartCaptButton(but_x, 55, 305, SHOW_IN_FOLDER);
DrawStandartCaptButton(but_x, 55, 306, OPEN_FILE_TEXT);
}
WriteText(cleft, ed.top + 4, 0x90, system.color.work_text, "URL:"); WriteText(cleft, ed.top + 4, 0x90, system.color.work_text, "URL:");
ed.left = strlen("URL:")*8 + 10 + cleft; ed.left = strlen("URL:")*8 + 10 + cleft;
ed.width = DL_Form.cwidth - ed.left - cleft - 3; ed.width = DL_Form.cwidth - ed.left - cleft - 3;
@ -170,10 +175,9 @@ void StartDownloading()
void DrawDownloading() void DrawDownloading()
{ {
char bytes_received[70]; char bytes_received[70];
dword tmp = ConvertSizeToKb(downloader.data_downloaded_size); sprintf(#bytes_received, KB_RECEIVED, ConvertSizeToKb(downloader.data_downloaded_size) );
sprintf(#bytes_received, "%s%s", tmp, KB_RECEIVED); DrawBar(15, pb.top + 22, strlen(#bytes_received+4)*12, 16, system.color.work);
DrawBar(pb.left, pb.top + 17, DL_Form.cwidth - pb.left, 9, system.color.work); WriteText(15, pb.top + 22, 0x90, system.color.work_text, #bytes_received);
WriteText(pb.left, pb.top + 17, 0x80, system.color.work_text, #bytes_received);
progressbar_draw stdcall(#pb); progressbar_draw stdcall(#pb);
} }

View File

@ -306,9 +306,9 @@ enum
notify(_last_msg); notify(_last_msg);
ExitProcess(); ExitProcess();
} }
:unsigned char size[25]=0;
:dword ConvertSizeToKb(unsigned int bytes) :dword ConvertSizeToKb(unsigned int bytes)
{ {
unsigned char size[25]=0;
unsigned int kb; unsigned int kb;
dword kb_line; dword kb_line;

View File

@ -77,7 +77,7 @@ int DOWNLOADER::MonitorProgress()
do { do {
$lodsb; $lodsb;
$stosb; $stosb;
} while (AL != 0) && (AL != 13) && (AL != 10)); } while ((AL != 0) && (AL != 13) && (AL != 10));
DSBYTE[EDI-1]='\0'; DSBYTE[EDI-1]='\0';
} }
get_absolute_url(#finaladress, url, #redirect_url); get_absolute_url(#finaladress, url, #redirect_url);