minor fixes

git-svn-id: svn://kolibrios.org@8281 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2020-11-30 00:55:04 +00:00
parent 5941f0e334
commit c92932964b
5 changed files with 29 additions and 24 deletions

View File

@ -6,18 +6,19 @@
#ifdef LANG_RUS #ifdef LANG_RUS
#define DL_WINDOW_HEADER "Œ¥­¥¤¦¥à § £à㧮ª" #define DL_WINDOW_HEADER "Œ¥­¥¤¦¥à § £à㧮ª"
#define START_DOWNLOADING "<EFBFBD> ç âì § ª çªã" #define START_DOWNLOADING "‘ª ç âì"
#define STOP_DOWNLOADING "Žâ¬¥­ " #define STOP_DOWNLOADING "Žâ¬¥­ "
#define SHOW_IN_FOLDER "<22>®ª § âì ¢ ¯ ¯ª¥" #define SHOW_IN_FOLDER "<22>®ª § âì ¢ ¯ ¯ª¥"
#define OPEN_FILE_TEXT "Žâªàëâì ä ©«" #define OPEN_FILE_TEXT "Žâªàëâì ä ©«"
#define FILE_SAVED_AS "'Œ¥­¥¤¦¥à § £à㧮ª\n” ©« á®åà ­¥­ ª ª %s' -Dt" #define FILE_SAVED_AS "'Œ¥­¥¤¦¥à § £à㧮ª\n” ©« á®åà ­¥­ ª ª %s' -Dt"
#define FILE_NOT_SAVED "'Œ¥­¥¤¦¥à § £à㧮ª\nŽè¨¡ª ! ” ©« ­¥ ¬®¦¥â ¡ëâì å®à ­¥­ ª ª\n%s' -Et" #define FILE_NOT_SAVED "'Œ¥­¥¤¦¥à § £à㧮ª\nŽè¨¡ª ! ” ©« ­¥ ¬®¦¥â ¡ëâì á®åà ­¥­ ª ª\n%s' -Et"
#define KB_RECEIVED "ˆ¤¥â ᪠稢 ­¨¥... %s ¯®«ã祭®" #define KB_RECEIVED "ˆ¤¥â ᪠稢 ­¨¥... %s ¯®«ã祭®"
#define T_ERROR_STARTING_DOWNLOAD "'<27>¥¢®§¬®¦­® ­ ç âì ᪠稢 ­¨¥.\n<>®¦ «ã©áâ , ¯à®¢¥àì⥠¢¢¥¤¥­­ë© ¯ãâì ¨ ᮥ¤¨­¥­¨¥ á ˆ­â¥à­¥â®¬.' -E" #define T_ERROR_STARTING_DOWNLOAD "'<27>¥¢®§¬®¦­® ­ ç âì ᪠稢 ­¨¥.\n<>®¦ «ã©áâ , ¯à®¢¥àì⥠¢¢¥¤¥­­ë© ¯ãâì ¨ ᮥ¤¨­¥­¨¥ á ˆ­â¥à­¥â®¬.' -E"
#define T_AUTOCLOSE "€¢â®§ ªàë⨥"
char accept_language[]= "Accept-Language: ru\n"; char accept_language[]= "Accept-Language: ru\n";
#else #else
#define DL_WINDOW_HEADER "Download Manager" #define DL_WINDOW_HEADER "Download Manager"
#define START_DOWNLOADING "Start downloading" #define START_DOWNLOADING "Download"
#define STOP_DOWNLOADING "Cancel" #define STOP_DOWNLOADING "Cancel"
#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"
@ -25,6 +26,7 @@
#define FILE_NOT_SAVED "'Download manager\nError! Can\96t save file as %s' -Et" #define FILE_NOT_SAVED "'Download manager\nError! Can\96t save file as %s' -Et"
#define KB_RECEIVED "Downloading... %s received" #define KB_RECEIVED "Downloading... %s received"
#define T_ERROR_STARTING_DOWNLOAD "'Error while starting download process.\nPlease, check entered path and Internet connection.' -E" #define T_ERROR_STARTING_DOWNLOAD "'Error while starting download process.\nPlease, check entered path and Internet connection.' -E"
#define T_AUTOCLOSE "Autoclose"
char accept_language[]= "Accept-Language: en\n"; char accept_language[]= "Accept-Language: en\n";
#endif #endif

View File

@ -3,19 +3,23 @@
#define MEMSIZE 1024 * 100 #define MEMSIZE 1024 * 100
#include "../lib/gui.h" #include "../lib/gui.h"
#include "../lib/random.h" #include "../lib/random.h"
#include "../lib/obj/box_lib.h" #include "../lib/obj/box_lib.h"
#include "../lib/obj/http.h" #include "../lib/obj/http.h"
#include "../lib/obj/libini.h"
#include "../lib/patterns/http_downloader.h" #include "../lib/patterns/http_downloader.h"
#include "const.h" #include "const.h"
DOWNLOADER downloader; DOWNLOADER downloader;
checkbox autoclose = { T_AUTOCLOSE, true };
char downloader_edit[4000]; char downloader_edit[4000];
char filepath[4096]; char filepath[4096];
edit_box ed = {WIN_W-GAPX-GAPX,GAPX,20,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000, edit_box ed = {WIN_W-GAPX-GAPX,GAPX,20,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,
sizeof(downloader_edit)-2,#downloader_edit,0,ed_focus,19,19}; sizeof(downloader_edit)-2,#downloader_edit,0,ed_focus,19,19};
progress_bar pb = {0, GAPX, 58, 350, 17, 0, 0, 100, 0xFFFfff, 0x74DA00, 0x9F9F9F}; progress_bar pb = {0, GAPX, 58, 315, 17, 0, 0, 100, 0xFFFfff, 0x74DA00, 0x9F9F9F};
//progress_bar: value, left, top, width, height, style, min, max, back_color, progress_color, frame_color; //progress_bar: value, left, top, width, height, style, min, max, back_color, progress_color, frame_color;
bool exit_when_done = false; bool exit_when_done = false;
@ -26,6 +30,7 @@ void main()
dword shared_url; dword shared_url;
load_dll(boxlib, #box_lib_init,0); load_dll(boxlib, #box_lib_init,0);
load_dll(libHTTP, #http_lib_init,1); load_dll(libHTTP, #http_lib_init,1);
load_dll(libini, #lib_init,1);
if (!dir_exists(#save_to)) CreateDir(#save_to); if (!dir_exists(#save_to)) CreateDir(#save_to);
@ -36,7 +41,7 @@ void main()
} }
if (!strncmp(#param, "-mem", 5)) { if (!strncmp(#param, "-mem", 5)) {
shared_url = memopen(#dl_shared, URL_SIZE+1, SHM_OPEN + SHM_WRITE); //shared_url = memopen(#dl_shared, URL_SIZE+1, SHM_OPEN + SHM_WRITE);
strcpy(#downloader_edit, shared_url); strcpy(#downloader_edit, shared_url);
} else { } else {
strcpy(#downloader_edit, #param); strcpy(#downloader_edit, #param);
@ -90,6 +95,7 @@ void main()
void ProcessEvent(int id) void ProcessEvent(int id)
{ {
autoclose.click(id);
if (id==001) { StopDownloading(); ExitProcess(); } if (id==001) { StopDownloading(); ExitProcess(); }
if (id==301) && (downloader.httpd.transfer <= 0) StartDownloading(); if (id==301) && (downloader.httpd.transfer <= 0) StartDownloading();
if (id==302) StopDownloading(); if (id==302) StopDownloading();
@ -103,24 +109,26 @@ void ProcessEvent(int id)
void DrawWindow() void DrawWindow()
{ {
int but_x = 0; int but_x = 0;
int but_y = 58; #define BUT_Y 58;
sc.get(); sc.get();
pb.frame_color = sc.work_dark; pb.frame_color = sc.work_dark;
DefineAndDrawWindow(110 + random(300), 100 + random(300), WIN_W+9, WIN_H + 5 + skin_height, 0x34, sc.work, DL_WINDOW_HEADER, 0); DefineAndDrawWindow(110 + random(300), 100 + random(300), WIN_W+9, WIN_H + 5 + skin_height, 0x34, sc.work, DL_WINDOW_HEADER, 0);
autoclose.draw(WIN_W-135, BUT_Y+6);
if (downloader.state == STATE_NOT_STARTED) || (downloader.state == STATE_COMPLETED) if (downloader.state == STATE_NOT_STARTED) || (downloader.state == STATE_COMPLETED)
{ {
but_x = GAPX + DrawStandartCaptButton(GAPX, but_y, 301, START_DOWNLOADING); but_x = GAPX + DrawStandartCaptButton(GAPX, BUT_Y, 301, START_DOWNLOADING);
if (filepath[0]) if (filepath[0])
{ {
but_x += DrawStandartCaptButton(but_x, but_y, 305, SHOW_IN_FOLDER); but_x += DrawStandartCaptButton(but_x, BUT_Y, 305, SHOW_IN_FOLDER);
DrawStandartCaptButton(but_x, but_y, 306, OPEN_FILE_TEXT); DrawStandartCaptButton(but_x, BUT_Y, 306, OPEN_FILE_TEXT);
} }
} }
if (downloader.state == STATE_IN_PROGRESS) if (downloader.state == STATE_IN_PROGRESS)
{ {
DrawStandartCaptButton(WIN_W - 190, but_y, 302, STOP_DOWNLOADING); DrawStandartCaptButton(WIN_W - 240, BUT_Y, 302, STOP_DOWNLOADING);
DrawDownloading(); DrawDownloading();
} }
ed.offset=0; ed.offset=0;
@ -239,4 +247,5 @@ void SaveDownloadedFile()
*/ */
if (!exit_when_done) notify(#notify_message); if (!exit_when_done) notify(#notify_message);
if (autoclose.checked) ExitProcess();
} }

View File

@ -19,13 +19,11 @@ dword edit_box_draw = #aEdit_box_draw;
dword edit_box_key = #aEdit_box_key; dword edit_box_key = #aEdit_box_key;
dword edit_box_mouse = #aEdit_box_mouse; dword edit_box_mouse = #aEdit_box_mouse;
dword edit_box_set_text = #aEdit_box_set_text; dword edit_box_set_text = #aEdit_box_set_text;
dword version_ed = #aVersion_ed;
dword scrollbar_v_draw = #aScrollbar_v_draw; dword scrollbar_v_draw = #aScrollbar_v_draw;
dword scrollbar_v_mouse = #aScrollbar_v_mouse; dword scrollbar_v_mouse = #aScrollbar_v_mouse;
dword scrollbar_h_draw = #aScrollbar_h_draw; dword scrollbar_h_draw = #aScrollbar_h_draw;
dword scrollbar_h_mouse = #aScrollbar_h_mouse; dword scrollbar_h_mouse = #aScrollbar_h_mouse;
dword version_scrollbar = #aVersion_scrollbar;
dword PathShow_prepare = #aPathShow_prepare; dword PathShow_prepare = #aPathShow_prepare;
dword PathShow_draw = #aPathShow_draw; dword PathShow_draw = #aPathShow_draw;
@ -41,14 +39,12 @@ char aEdit_box_draw [] = "edit_box";
char aEdit_box_key [] = "edit_box_key"; char aEdit_box_key [] = "edit_box_key";
char aEdit_box_mouse[] = "edit_box_mouse"; char aEdit_box_mouse[] = "edit_box_mouse";
char aEdit_box_set_text[] = "edit_box_set_text"; char aEdit_box_set_text[] = "edit_box_set_text";
char aVersion_ed [] = "version_ed";
char aboxlib_init[] = "lib_init"; char aboxlib_init[] = "lib_init";
char aScrollbar_v_draw [] = "scrollbar_v_draw"; char aScrollbar_v_draw [] = "scrollbar_v_draw";
char aScrollbar_v_mouse[] = "scrollbar_v_mouse"; char aScrollbar_v_mouse[] = "scrollbar_v_mouse";
char aScrollbar_h_draw [] = "scrollbar_h_draw"; char aScrollbar_h_draw [] = "scrollbar_h_draw";
char aScrollbar_h_mouse[] = "scrollbar_h_mouse"; char aScrollbar_h_mouse[] = "scrollbar_h_mouse";
char aVersion_scrollbar[] = "version_scrollbar";
char aPathShow_prepare [] = "PathShow_prepare"; char aPathShow_prepare [] = "PathShow_prepare";
char aPathShow_draw [] = "PathShow_draw"; char aPathShow_draw [] = "PathShow_draw";

View File

@ -25,8 +25,8 @@ dword ChangeCharset(dword from_chs, to_chs, conv_buf)
from_chs = from_chs*10+#charsets; from_chs = from_chs*10+#charsets;
debug("iconv: from_chs = "); debugln(from_chs); //debug("iconv: from_chs = "); debugln(from_chs);
debug("iconv: to_chs = "); debugln(to_chs); //debug("iconv: to_chs = "); debugln(to_chs);
iconv_open stdcall (from_chs, to_chs); //CP866, CP1251, CP1252, KOI8-RU, UTF-8, ISO8859-5 iconv_open stdcall (from_chs, to_chs); //CP866, CP1251, CP1252, KOI8-RU, UTF-8, ISO8859-5
if (EAX==-1) { if (EAX==-1) {
@ -38,9 +38,9 @@ dword ChangeCharset(dword from_chs, to_chs, conv_buf)
in_len = out_len = strlen(conv_buf)+1; in_len = out_len = strlen(conv_buf)+1;
new_buf = mem_Alloc(in_len); new_buf = mem_Alloc(in_len);
iconv stdcall (cd, #conv_buf, #in_len, #new_buf, #out_len); iconv stdcall (cd, #conv_buf, #in_len, #new_buf, #out_len);
cd = EAX; if (EAX!=0)
if (cd!=0)
{ {
cd = EAX;
debugval("iconv: something is wrong with stdcall iconv()", cd); debugval("iconv: something is wrong with stdcall iconv()", cd);
debugval("in_len", in_len); debugval("in_len", in_len);
debugval("out_len", out_len); debugval("out_len", out_len);

View File

@ -23,7 +23,6 @@
#include "../lib/obj/libio.h" #include "../lib/obj/libio.h"
#include "../lib/obj/libimg.h" #include "../lib/obj/libimg.h"
#include "../lib/obj/libini.h"
#include "../lib/obj/box_lib.h" #include "../lib/obj/box_lib.h"
#include "../lib/patterns/select_list.h" #include "../lib/patterns/select_list.h"
@ -110,7 +109,6 @@ void load_lib()
{ {
load_dll(libio, #libio_init,1); load_dll(libio, #libio_init,1);
load_dll(libimg, #libimg_init,1); load_dll(libimg, #libimg_init,1);
load_dll(libini, #lib_init,1);
load_dll(boxlib, #box_lib_init,0); load_dll(boxlib, #box_lib_init,0);
} }