Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5492 → Rev 5493

/programs/cmm/TWB/TWB.c
2,7 → 2,7
dword o_bufpointer;
dword bufsize;
 
#define URL param
char URL[10000];
 
scroll_bar scroll_wv = { 15,200,398,44,0,2,115,15,0,0xeeeeee,0xBBBbbb,0xeeeeee,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1};
 
422,6 → 422,11
}
if (isTag("div")) || (isTag("header")) || (isTag("article")) || (isTag("footer")) {
IF(oldtag[0] <>'h') NewLine();
if (!strcmp(#parametr, "bgcolor="))
{
bg_color=GetColor(#options);
DrawBuf.Fill(bg_color);
}
return;
}
if (isTag("p")) {
/programs/cmm/browser/WebView.c
29,10 → 29,10
//useful patterns
#include "..\lib\patterns\libimg_load_skin.h"
 
char homepage[] = FROM "html\homepage.htm";
char homepage[] = FROM "html\\homepage.htm";
 
#ifdef LANG_RUS
char version[]=" ’¥ªáâ®¢ë© ¡à ã§¥à 1.0 Beta 6.2";
char version[]=" ’¥ªáâ®¢ë© ¡à ã§¥à 1.0";
?define IMAGES_CACHE_CLEARED "Šíè ª à⨭®ª ®ç¨é¥­"
?define T_LAST_SLIDE "â® ¯®á«¥¤­¨© á« ©¤"
char loading[] = "‡ £à㧪  áâà ­¨æë...<br>";
39,7 → 39,7
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.0 Beta 6.2";
char version[]=" Text-based Browser 1.0";
?define IMAGES_CACHE_CLEARED "Images cache cleared"
?define T_LAST_SLIDE "This slide is the last"
char loading[] = "Loading...<br>";
77,6 → 77,7
#include "menu_rmb.h"
#include "history.h"
#include "show_src.h"
#include "downloader.h"
 
char editURL[sizeof(URL)];
int mouse_twb;
133,9 → 134,11
Form.width=WIN_W;
Form.height=WIN_H;
SetElementSizes();
if (!URL) strcpy(#URL, URL_SERVICE_HOME);
if (param) strcpy(#URL, #param); else strcpy(#URL, URL_SERVICE_HOME);
OpenPage();
 
CreateDir("/tmp0/1/downloads");
 
SetEventMask(0xa7);
loop()
{
376,6 → 379,11
OpenPage();
return;
 
case 006: //download manager
DL_URL[0] = 0;
CreateThread(#Downloader,#downloader_stak+4092);
return;
 
case BACK:
if (!BrowserHistory.GoBack()) return;
OpenPage();
416,9 → 424,6
MoveSize(190,80,OLD,OLD);
RunProgram(#program_path, #URL);
return;
case HOME:
strcpy(#editURL, "http://kolibrios.org/");
case GOTOURL:
case 0x0D: //enter
if (!editURL[0]) return;
525,10 → 530,19
PageLinks.GetAbsoluteURL(#URL);
if (!strcmp(#URL + strlen(#URL) - 4, ".gif")) || (!strcmp(#URL + strlen(#URL) - 4, ".png")) || (!strcmp(#URL + strlen(#URL) - 4, ".jpg"))
if (UrlExtIs(".png")==1) || (UrlExtIs(".gif")==1) || (UrlExtIs(".jpg")==1) || (UrlExtIs(".zip")==1)
|| (UrlExtIs(".7z")==1) || (UrlExtIs("netcfg")==1)
{
//if (strstr(#URL,"http:"))
RunProgram("/sys/media/kiv", #URL);
notify(#URL);
if (strcmpn(#URL,"http://:", 8)==0)
{
strcpy(#DL_URL, #URL);
CreateThread(#Downloader,#downloader_stak+4092);
}
else
{
RunProgram("@open", #URL);
}
strcpy(#editURL, BrowserHistory.CurrentUrl());
strcpy(#URL, BrowserHistory.CurrentUrl());
return;
651,7 → 665,14
if (!strcmp(#version, #header)) DrawTitle(#header);
}
 
byte UrlExtIs(dword ext)
{
if (strcmpi(#URL + strlen(#URL) - strlen(ext), ext)==0) return 1; else return 0;
}
 
 
 
 
stop:
 
char downloader_stak[4096];
/programs/cmm/browser/downloader.h
0,0 → 1,223
#ifdef LANG_RUS
#define DL_WINDOW_HEADER "Download Manager"
#define START_DOWNLOADING "Start downloading"
#define STOP_DOWNLOADING "Stop downloading"
#define FILE_SAVED_AS "'Download manager\nFile saved as "
#define DOWNLOADING_COMPLETE "Downloading complete."
#else
#define DL_WINDOW_HEADER "Download Manager"
#define START_DOWNLOADING "Start downloading"
#define STOP_DOWNLOADING "Stop downloading"
#define FILE_SAVED_AS "'Download manager\nFile saved as "
#define DOWNLOADING_COMPLETE "Downloading complete."
#endif
 
proc_info DL_Form;
system_colors sc;
char DL_URL[10000];
dword DL_bufpointer;
dword DL_bufsize;
dword DL_http_transfer;
dword 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};
 
char save_to[4096] = "/tmp0/1/Downloads/";
byte cleft = 10;
 
 
void Downloader()
{
int key, btn;
mouse m;
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;
 
SetEventMask(0x27);
loop()
{
WaitEventTimeout(40);
switch(EAX & 0xFF)
{
CASE evMouse:
if (!CheckActiveProcess(DL_Form.ID)) break;
if (DL_http_transfer <= 0) edit_box_mouse stdcall (#DL_address_box);
break;
 
case evButton:
btn=GetButtonID();
if (btn==1) ExitProcess();
DL_Scan(btn);
break;
 
case evKey:
key = GetKey();
if (DL_address_box.flags & 0b10)
{
EAX=key<<8;
edit_box_key stdcall(#DL_address_box);
}
if (key==13) DL_Scan(301);
break;
 
case evReDraw:
sc.get();
DefineAndDrawWindow(215, 100, 420, 150, 0x74, sc.work, DL_WINDOW_HEADER, 0);
GetProcessInfo(#DL_Form, SelfInfo);
if (DL_Form.status_window>2) break;
if (DL_Form.height<120) MoveSize(OLD,OLD,OLD,120);
if (DL_Form.width<280) MoveSize(OLD,OLD,280,OLD);
DL_Draw_Window();
break;
default:
if (DL_Form.width==0) break;
if (DL_http_transfer <= 0) break;
http_process stdcall (DL_http_transfer);
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;
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");
}
else
{
strcpy(#notify_message, "'Download manager\nError! Can\96t save file as ");
strcat(#notify_message, #filepath);
strcat(#notify_message, "' -Et");
}
notify(#notify_message);
DL_address_box.color = DL_address_box.blur_border_color = DL_address_box.focus_border_color = 0xFFFfff;
DL_Draw_Window();
}
ESI = DL_http_transfer;
downloaded_size = ESI.http_msg.content_received;
full_size = ESI.http_msg.content_length;
DrawDownloading();
}
}
}
 
void DrawDownloading()
{
dword tmp;
char bytes_received[70], percent[30];
 
percent[0]=0;
 
if (DL_http_transfer > 0)
{
strcpy(#bytes_received, "Downloading... ");
tmp = ConvertSizeToKb(downloaded_size);
strcat(#bytes_received, tmp);
strcat(#bytes_received, " received.");
if (full_size>0)
{
tmp = itoa(downloaded_size * 100 / full_size);
strcpy(#percent, tmp);
strcat(#percent, " \x25");
}
}
else
{
strcpy(#bytes_received, DOWNLOADING_COMPLETE);
}
DrawBar(cleft, 90, DL_Form.cwidth - cleft, 9, sc.work);
WriteText(cleft, 90, 0x80, sc.work_text, #bytes_received);
WriteText(DL_Form.cwidth - 50, 90, 0x80, sc.work_text, #percent);
}
 
void DL_Draw_Window()
{
DrawBar(0,0,DL_Form.cwidth,DL_Form.cheight,sc.work); //bg
if (DL_http_transfer <= 0)
{
DrawCaptButton(cleft, 50, 120, 20, 301, sc.work_button, sc.work_button_text, START_DOWNLOADING);
}
else
{
DrawCaptButton(cleft, 50, 120, 20, 302, sc.work_button, sc.work_button_text, STOP_DOWNLOADING);
}
if (DL_http_transfer <= 0)
{
DrawCaptButton(cleft+130, 50, 120, 20, 305, sc.work_button, sc.work_button_text, "Show in folder");
DrawCaptButton(cleft+260, 50, 120, 20, 306, sc.work_button, sc.work_button_text, "Open file");
}
WriteText(cleft, DL_address_box.top + 4, 0x80, sc.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,sc.work_graph);
 
DrawDownloading();
}
 
void DL_Scan(int id)
{
if (id==301) && (DL_http_transfer <= 0) StartDownloading();
if (id==302) StopDownloading();
if (id==305) RunProgram("/sys/File managers/Eolite", #save_to);
if (id==306) RunProgram("@open", #filepath);
}
 
 
void StopDownloading()
{
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 = DL_address_box.focus_border_color = 0xFFFfff;
DL_Draw_Window();
}
 
void StartDownloading()
{
StopDownloading();
if (strncmp(#DL_URL,"http:",5)==0)
{
DL_address_box.color = DL_address_box.blur_border_color = DL_address_box.focus_border_color = 0xededed;
http_get stdcall (#DL_URL, #accept_language);
DL_http_transfer = EAX;
DL_Draw_Window();
if (DL_http_transfer == 0)
{
StopDownloading();
DL_bufsize = 0;
DL_bufpointer = mem_Free(DL_bufpointer);
return;
}
}
else
{
notify("File adress should starts from http://");
}
}
/programs/cmm/browser/html/page_not_found_en.htm
9,10 → 9,10
<ul>
<li>
Make sure that evetything fine with Internet connection.<br>
Open /sys/network/netcfg network diagnostic tool.<br>
Open <a href="/sys/network/netcfg">Netcfg</a> network diagnostic tool.<br>
</li>
<li>
Check page address, there may have been made ​​a typo.<br>
Check page address, there may have been made a typo.<br>
</li>
<li>
Server is temporarily unavailable.<br>
/programs/cmm/browser/html/page_not_found_ru.htm
10,7 → 10,7
<ul>
<li>
“¡¥¤¨â¥áì, çâ® ¥áâì ¯®¤ª«î祭¨¥ ª á¥â¨ ˆ­â¥à­¥â.<br>
Žâªà®©â¥ /sys/network/netcfg ¤«ï ¤¨ £­®á⨪¨ á¥â¨.<br>
Žâªà®©â¥ <a href="/sys/network/netcfg">Netcfg</a> ¤«ï ¤¨ £­®á⨪¨ á¥â¨.<br>
</li>
<li>
à®¢¥àì⥠ ¤à¥áá áâà ­¨æë, ¢®§¬®¦­®, ¡ë«  ᤥ« ­  ®¯¥ç âª .<br>
/programs/cmm/browser/menu_rmb.h
10,11 → 10,13
"¥¤ ªâ¨à®¢ âì ¨á室­¨ª F4",53,
"Žç¨áâ¨âì ªíè ª à⨭®ª" ,02,
"ˆáâ®à¨ï" ,03,
"Œ¥­¥¤¦¥à § £à㧮ª" ,06,
#else
"View source F3",52,
"Edit source F4",53,
"Free image cache" ,09,
"History" ,03,
"Download Manager" ,06,
#endif
0};
 
/programs/cmm/downloader/Downloader.c
86,7 → 86,7
sc.get();
DefineAndDrawWindow(215,100,WIN_W,WIN_H,0x73,sc.work,#header,0);
GetProcessInfo(#Form, SelfInfo);
if (Form.status_window>2) return;
if (Form.status_window>2) break;
if (Form.height<120) MoveSize(OLD,OLD,OLD,120);
if (Form.width<280) MoveSize(OLD,OLD,280,OLD);
diagram.Init(20, 87, Form.cwidth - 40, Form.cheight - 87 - 28);
105,7 → 105,7
http_transfer=0;
strcpy(#filepath, "/tmp0/1/");
strcat(#filepath, #URL+strrchr(#URL, '/'));
if (WriteFile(bufsize, bufpointer, #filepath))
if (!WriteFile(bufsize, bufpointer, #filepath))
{
strcpy(#notify_message, "File saved as ");
}
235,7 → 235,7
}
else
{
notify("File adress should starts form http://");
notify("File adress should starts from http://");
}
}
 
/programs/cmm/eolite/include/icons.h
19,7 → 19,7
"nes", 18, "smc", 18,
"gif", 19, "bmp", 19, "tga", 19, "pcx", 19, "png", 19, "pnm", 19, "jpg", 19, "xcf", 19, "ai", 19,
"jpeg",19, "raw", 11, "psd", 19, "wbmp",19, "tiff",19, "tif", 19,
"3ds", 20, "ico", 20, "cur", 20, "ani", 20, "vox", 20,
"3ds", 20, "asc", 20, "ico", 20, "cur", 20, "ani", 20, "vox", 20,
"img", 21, "ima", 21,
"dll", 22, "obj", 22, "dict",22,
"rar", 23, "zip", 23, "cab", 23, "tar", 23, "ajr", 23, "jar", 23, "7z", 23, "gz", 23, "kexp", 23,
/programs/cmm/lib/file_system.h
272,4 → 272,17
itoa_(#size_prefix, bytes);
strcat(#size_prefix, #size_nm);
return #size_prefix;
}
 
:dword ConvertSizeToKb(unsigned int bytes)
{
unsigned char size[25]=0;
unsigned int kb;
dword kb_line;
 
kb_line = itoa(bytes / 1024);
strcpy(#size, kb_line);
strcat(#size, " Kb");
 
return #size;
}