mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-11-28 11:43:09 +03:00
HTML: trying to divide network code form GUI and various fixes
git-svn-id: svn://kolibrios.org@5685 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
88b64ba405
commit
507d835895
@ -30,14 +30,14 @@
|
||||
char homepage[] = FROM "html\\homepage.htm";
|
||||
|
||||
#ifdef LANG_RUS
|
||||
char version[]=" ’¥ªáâ®¢ë© ¡à 㧥à 1.14";
|
||||
char version[]=" ’¥ªáâ®¢ë© ¡à 㧥à 1.15";
|
||||
?define IMAGES_CACHE_CLEARED "Šíè ª à⨮ª ®ç¨é¥"
|
||||
?define T_LAST_SLIDE "<EFBFBD>â® ¯®á«¥¤¨© á« ©¤"
|
||||
char loading[] = "‡ £à㧪 áâà ¨æë...<br>";
|
||||
char page_not_found[] = FROM "html\page_not_found_ru.htm";
|
||||
char accept_language[]= "Accept-Language: ru\n";
|
||||
#else
|
||||
char version[]=" Text-based Browser 1.12";
|
||||
char version[]=" Text-based Browser 1.15";
|
||||
?define IMAGES_CACHE_CLEARED "Images cache cleared"
|
||||
?define T_LAST_SLIDE "This slide is the last"
|
||||
char loading[] = "Loading...<br>";
|
||||
@ -77,6 +77,7 @@ byte souce_mode = false;
|
||||
#include "menu_rmb.h"
|
||||
#include "history.h"
|
||||
#include "show_src.h"
|
||||
#include "network_get.h"
|
||||
#include "downloader.h"
|
||||
|
||||
char editURL[sizeof(URL)];
|
||||
|
@ -17,12 +17,9 @@
|
||||
#endif
|
||||
|
||||
proc_info DL_Form;
|
||||
char DL_URL[10000];
|
||||
dword DL_bufpointer, DL_bufsize, DL_http_transfer, DL_http_buffer;
|
||||
char filepath[4096];
|
||||
int downloaded_size, full_size;
|
||||
int mouse_twbi;
|
||||
edit_box DL_address_box = {250,20,20,0xffffff,0x94AECE,0xffffff,0xffffff,0,sizeof(DL_URL),#DL_URL,#mouse_twbi,2,19,19};
|
||||
edit_box dl_edit = {250,20,20,0xffffff,0x94AECE,0xffffff,0xffffff,0,sizeof(DL_URL),#DL_URL,#mouse_twbi,2,19,19};
|
||||
progress_bar DL_progress_bar = {0, 170, 51, 225, 12, 0, 0, 100, 0xFFFfff, 0x74DA00, 0x9F9F9F};
|
||||
|
||||
char save_to[4096] = "/tmp0/1/Downloads/";
|
||||
@ -30,26 +27,19 @@ byte cleft = 15;
|
||||
|
||||
byte downloader_opened;
|
||||
|
||||
byte download_state;
|
||||
enum { STATE_NOT_STARTED, STATE_IN_PROGRESS, STATE_COMPLETED };
|
||||
|
||||
|
||||
void Downloader()
|
||||
{
|
||||
int key, btn;
|
||||
|
||||
int key;
|
||||
char notify_message[4296];
|
||||
|
||||
if (DL_URL[0]) {
|
||||
StartDownloading();
|
||||
}
|
||||
else strcpy(#DL_URL, "http://");
|
||||
DL_address_box.size = DL_address_box.pos = DL_address_box.shift = DL_address_box.shift_old = strlen(#DL_URL);
|
||||
|
||||
downloaded_size = full_size = 0;
|
||||
downloader_opened = 1;
|
||||
|
||||
SetEventMask(0x27);
|
||||
|
||||
if (DL_URL[0]) StartDownloading(); else strcpy(#DL_URL, "http://");
|
||||
dl_edit.size = dl_edit.pos = dl_edit.shift = dl_edit.shift_old = strlen(#DL_URL);
|
||||
|
||||
Downloading_SetDefaults();
|
||||
|
||||
loop()
|
||||
{
|
||||
WaitEventTimeout(40);
|
||||
@ -57,18 +47,17 @@ void Downloader()
|
||||
{
|
||||
CASE evMouse:
|
||||
if (!CheckActiveProcess(DL_Form.ID)) break;
|
||||
if (DL_http_transfer <= 0) edit_box_mouse stdcall (#DL_address_box);
|
||||
edit_box_mouse stdcall (#dl_edit);
|
||||
break;
|
||||
|
||||
case evButton:
|
||||
btn=GetButtonID();
|
||||
DL_Scan(btn);
|
||||
DL_Scan(GetButtonID());
|
||||
break;
|
||||
|
||||
case evKey:
|
||||
key = GetKey();
|
||||
EAX=key<<8;
|
||||
edit_box_key stdcall(#DL_address_box);
|
||||
edit_box_key stdcall(#dl_edit);
|
||||
if (key==13) DL_Scan(301);
|
||||
break;
|
||||
|
||||
@ -95,28 +84,20 @@ void Downloader()
|
||||
}
|
||||
$pop EAX
|
||||
if (EAX == 0) {
|
||||
ESI = DL_http_transfer;
|
||||
DL_bufpointer = ESI.http_msg.content_ptr;
|
||||
DL_bufsize = ESI.http_msg.content_received;
|
||||
http_free stdcall (DL_http_transfer);
|
||||
DL_http_transfer=0;
|
||||
Downloading_Completed();
|
||||
strcpy(#filepath, #save_to);
|
||||
strcat(#filepath, #DL_URL+strrchr(#DL_URL, '/'));
|
||||
if (WriteFile(DL_bufsize, DL_bufpointer, #filepath)==0)
|
||||
{
|
||||
strcpy(#notify_message, FILE_SAVED_AS);
|
||||
strcat(#notify_message, #filepath);
|
||||
strcat(#notify_message, "' -Dt");
|
||||
sprintf(#notify_message, "%s%s%s",FILE_SAVED_AS,#filepath,"' -Dt");
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(#notify_message, "'Download manager\nError! Can\96t save file as ");
|
||||
strcat(#notify_message, #filepath);
|
||||
strcat(#notify_message, "' -Et");
|
||||
sprintf(#notify_message, "%s%s%s","'Download manager\nError! Can\96t save file as ",#filepath,"' -Et");
|
||||
}
|
||||
notify(#notify_message);
|
||||
DL_address_box.color = DL_address_box.blur_border_color = DL_address_box.focus_border_color = 0xFFFfff;
|
||||
download_state = STATE_COMPLETED;
|
||||
dl_edit.blur_border_color = 0xFFFfff;
|
||||
dl_edit.flags = 10b;
|
||||
DL_Draw_Window();
|
||||
break;
|
||||
}
|
||||
@ -149,13 +130,13 @@ void DL_Draw_Window()
|
||||
DrawCaptButton(cleft+140, 50, 110, 27, 305, system.color.work_button, system.color.work_button_text, SHOW_IN_FOLDER);
|
||||
DrawCaptButton(cleft+260, 50, 120, 27, 306, system.color.work_button, system.color.work_button_text, OPEN_FILE);
|
||||
}
|
||||
WriteText(cleft, DL_address_box.top + 4, 0x80, system.color.work_text, "URL:");
|
||||
DL_address_box.left = strlen("URL:")*6 + 10 + cleft;
|
||||
DL_address_box.width = DL_Form.cwidth - DL_address_box.left - cleft - 3;
|
||||
DL_address_box.offset=0;
|
||||
edit_box_draw stdcall(#DL_address_box);
|
||||
DrawRectangle(DL_address_box.left-1, DL_address_box.top-1, DL_address_box.width+2, 16, DL_address_box.color);
|
||||
DrawRectangle(DL_address_box.left-2, DL_address_box.top-2, DL_address_box.width+4, 18, border_color);
|
||||
WriteText(cleft, dl_edit.top + 4, 0x80, system.color.work_text, "URL:");
|
||||
dl_edit.left = strlen("URL:")*6 + 10 + cleft;
|
||||
dl_edit.width = DL_Form.cwidth - dl_edit.left - cleft - 3;
|
||||
dl_edit.offset=0;
|
||||
edit_box_draw stdcall(#dl_edit);
|
||||
DrawRectangle(dl_edit.left-1, dl_edit.top-1, dl_edit.width+2, 16, dl_edit.blur_border_color);
|
||||
DrawRectangle(dl_edit.left-2, dl_edit.top-2, dl_edit.width+4, 18, border_color);
|
||||
}
|
||||
|
||||
|
||||
@ -191,22 +172,9 @@ void DL_Scan(int id)
|
||||
|
||||
void StopDownloading()
|
||||
{
|
||||
download_state = STATE_NOT_STARTED;
|
||||
if (DL_http_transfer<>0)
|
||||
{
|
||||
EAX = DL_http_transfer;
|
||||
EAX = EAX.http_msg.content_ptr; // get pointer to data
|
||||
$push EAX // save it on the stack
|
||||
http_free stdcall (DL_http_transfer); // abort connection
|
||||
$pop EAX
|
||||
mem_Free(EAX); // free data
|
||||
DL_http_transfer=0;
|
||||
DL_bufsize = 0;
|
||||
DL_bufpointer = mem_Free(DL_bufpointer);
|
||||
downloaded_size = full_size = 0;
|
||||
}
|
||||
DL_address_box.color = DL_address_box.blur_border_color = 0xFFFfff;
|
||||
DL_address_box.flags = 10b;
|
||||
Downloading_Stop();
|
||||
dl_edit.blur_border_color = 0xFFFfff;
|
||||
dl_edit.flags = 10b;
|
||||
DL_Draw_Window();
|
||||
}
|
||||
|
||||
@ -215,11 +183,9 @@ void StartDownloading()
|
||||
StopDownloading();
|
||||
if (strncmp(#DL_URL,"http:",5)==0)
|
||||
{
|
||||
download_state = STATE_IN_PROGRESS;
|
||||
DL_address_box.color = DL_address_box.blur_border_color = 0xCACACA;
|
||||
DL_address_box.flags = 100000000000b;
|
||||
http_get stdcall (#DL_URL, 0, 0, #accept_language);
|
||||
DL_http_transfer = EAX;
|
||||
Downloading_Start();
|
||||
dl_edit.blur_border_color = 0xCACACA;
|
||||
dl_edit.flags = 100000000000b;
|
||||
DL_progress_bar.value = 0;
|
||||
DL_Draw_Window();
|
||||
if (DL_http_transfer == 0)
|
||||
|
@ -18,7 +18,7 @@ ShowHistory()
|
||||
strcat(history_pointer, BrowserHistory.GetUrl(i));
|
||||
strcat(history_pointer, "</a><br>");
|
||||
}
|
||||
strcat(history_pointer, "</blockquote><h2>Cached images</h2><br>");
|
||||
strcat(history_pointer, "</blockquote><h2>Cached images</h2>");
|
||||
for (i=1; i<ImgCache.pics_count; i++)
|
||||
{
|
||||
strcat(history_pointer, "<img src='");
|
||||
|
51
programs/cmm/browser/network_get.h
Normal file
51
programs/cmm/browser/network_get.h
Normal file
@ -0,0 +1,51 @@
|
||||
|
||||
char DL_URL[10000];
|
||||
dword DL_bufpointer, DL_bufsize, DL_http_transfer, DL_http_buffer;
|
||||
|
||||
int downloaded_size, full_size;
|
||||
|
||||
byte download_state;
|
||||
enum { STATE_NOT_STARTED, STATE_IN_PROGRESS, STATE_COMPLETED };
|
||||
|
||||
|
||||
|
||||
|
||||
void Downloading_SetDefaults()
|
||||
{
|
||||
downloaded_size = full_size = 0;
|
||||
}
|
||||
|
||||
void Downloading_Stop()
|
||||
{
|
||||
download_state = STATE_NOT_STARTED;
|
||||
if (DL_http_transfer<>0)
|
||||
{
|
||||
EAX = DL_http_transfer;
|
||||
EAX = EAX.http_msg.content_ptr; // get pointer to data
|
||||
$push EAX // save it on the stack
|
||||
http_free stdcall (DL_http_transfer); // abort connection
|
||||
$pop EAX
|
||||
mem_Free(EAX); // free data
|
||||
DL_http_transfer=0;
|
||||
DL_bufsize = 0;
|
||||
DL_bufpointer = mem_Free(DL_bufpointer);
|
||||
Downloading_SetDefaults();
|
||||
}
|
||||
}
|
||||
|
||||
void Downloading_Start()
|
||||
{
|
||||
download_state = STATE_IN_PROGRESS;
|
||||
http_get stdcall (#DL_URL, 0, 0, #accept_language);
|
||||
DL_http_transfer = EAX;
|
||||
}
|
||||
|
||||
void Downloading_Completed()
|
||||
{
|
||||
ESI = DL_http_transfer;
|
||||
DL_bufpointer = ESI.http_msg.content_ptr;
|
||||
DL_bufsize = ESI.http_msg.content_received;
|
||||
http_free stdcall (DL_http_transfer);
|
||||
DL_http_transfer=0;
|
||||
download_state = STATE_COMPLETED;
|
||||
}
|
@ -103,8 +103,8 @@
|
||||
enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir
|
||||
enum { CREATE_FILE=1, CREATE_FOLDER, RENAME_ITEM }; //NewElement
|
||||
|
||||
#define TITLE "Eolite File Manager v2.91"
|
||||
#define ABOUT_TITLE "Eolite v2.91"
|
||||
#define TITLE "Eolite File Manager v2.92"
|
||||
#define ABOUT_TITLE "Eolite 2.92"
|
||||
dword col_padding, col_selec, col_lpanel;
|
||||
|
||||
int toolbar_buttons_x[7]={9,46,85,134,167,203};
|
||||
|
@ -50,18 +50,18 @@ void about_dialog()
|
||||
break;
|
||||
|
||||
case evReDraw:
|
||||
DefineAndDrawWindow(Form.left+Form.width/2,Form.top+Form.height/2-114,300,228+GetSkinHeight(),0x34,system.color.work,INTRO_TEXT_1);
|
||||
DefineAndDrawWindow(Form.left+Form.width/2,Form.top+Form.height/2-114,300,248+GetSkinHeight(),0x34,system.color.work,INTRO_TEXT_1);
|
||||
GetProcessInfo(#about_form, SelfInfo);
|
||||
if (Form.status_window>2) break;
|
||||
DrawBar(0,0,about_form.cwidth,50,0x8494C4);
|
||||
PutPaletteImage(#logo,85,85,about_form.width/2-43,7,8,#logo_pal);
|
||||
WriteTextB(about_form.width/2-46,100,0x90,0xBF40BF,ABOUT_TITLE);
|
||||
WriteTextCenter(0,120,about_form.cwidth,0,INTRO_TEXT_2);
|
||||
WriteTextCenter(0,130,about_form.cwidth,0,"Leency Veliant PunkJoker Pavelyakov");
|
||||
WriteTextCenter(0,140,about_form.cwidth,0,"KolibriOS Team");
|
||||
WriteTextCenter(0,150,about_form.cwidth,0,"2008-2015");
|
||||
WriteTextCenter(10,170,about_form.width-125,0,INTRO_TEXT_3);
|
||||
DrawLink(about_form.width/2-15,170,0x80,23, "kolibri-n.org");
|
||||
DrawFlatButton(about_form.width/2-35,about_form.height-60,70,22,10,0xE4DFE1, INTRO_TEXT_4);
|
||||
PutPaletteImage(#logo,85,85,about_form.cwidth/2-43,7,8,#logo_pal);
|
||||
WriteTextB(about_form.cwidth/2-66,100,0x81,0xBF40BF,ABOUT_TITLE);
|
||||
WriteTextCenter(0,130,about_form.cwidth,0,INTRO_TEXT_2);
|
||||
WriteTextCenter(0,143,about_form.cwidth,0,"Leency Veliant PunkJoker Pavelyakov");
|
||||
WriteTextCenter(0,156,about_form.cwidth,0,"KolibriOS Team");
|
||||
WriteTextCenter(0,169,about_form.cwidth,0,"2008-2015");
|
||||
WriteTextCenter(10,182,about_form.width-125,0,INTRO_TEXT_3);
|
||||
DrawLink(about_form.cwidth/2-15,182,0x80,23, "kolibri-n.org");
|
||||
DrawFlatButton(about_form.cwidth/2-35,about_form.cheight-35,70,22,10,0xE4DFE1, INTRO_TEXT_4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -145,8 +145,25 @@ struct menu_data
|
||||
};
|
||||
|
||||
struct edit_box{
|
||||
dword width, left, top, color, shift_color, focus_border_color, blur_border_color,
|
||||
text_color, max, text, mouse_variable, flags, size, pos, offset, cl_curs_x, cl_curs_y, shift, shift_old;
|
||||
dword width,
|
||||
left,
|
||||
top,
|
||||
color,
|
||||
shift_color,
|
||||
focus_border_color,
|
||||
blur_border_color,
|
||||
text_color,
|
||||
max,
|
||||
text,
|
||||
mouse_variable,
|
||||
flags,
|
||||
size,
|
||||
pos,
|
||||
offset,
|
||||
cl_curs_x,
|
||||
cl_curs_y,
|
||||
shift,
|
||||
shift_old;
|
||||
};
|
||||
|
||||
struct checkbox2
|
||||
|
Loading…
Reference in New Issue
Block a user