From b7d84b4904da6a1aa19d3a8c47ddcd8968f43f62 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Sun, 8 Mar 2015 14:39:42 +0000 Subject: [PATCH] Pixie 1.1: remember position for window each size, fix for list navigation git-svn-id: svn://kolibrios.org@5509 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/browser/WebView.c | 2 +- programs/cmm/pixie/pixie.c | 38 ++++++++++++++++++------------- programs/cmm/pixie/settings.h | 41 ++++++++++++++++++++-------------- 3 files changed, 47 insertions(+), 34 deletions(-) diff --git a/programs/cmm/browser/WebView.c b/programs/cmm/browser/WebView.c index 44f381cf99..f8f2c1b7c3 100644 --- a/programs/cmm/browser/WebView.c +++ b/programs/cmm/browser/WebView.c @@ -533,7 +533,7 @@ void ProcessLinks(int id) if (UrlExtIs(".png")==1) || (UrlExtIs(".gif")==1) || (UrlExtIs(".jpg")==1) || (UrlExtIs(".zip")==1) || (UrlExtIs(".7z")==1) || (UrlExtIs("netcfg")==1) { - notify(#URL); + //notify(#URL); if (strcmpn(#URL,"http://:", 8)==0) { strcpy(#DL_URL, #URL); diff --git a/programs/cmm/pixie/pixie.c b/programs/cmm/pixie/pixie.c index 96dac041fc..85901bbef6 100644 --- a/programs/cmm/pixie/pixie.c +++ b/programs/cmm/pixie/pixie.c @@ -1,5 +1,4 @@ //flac -//open last folder at start up //do not open multiple threads //edit list manually @@ -41,7 +40,8 @@ int player_run_id, int current_playing_file_n; -word win_x, win_y; +word win_x_normal, win_y_normal; +word win_x_small, win_y_small; byte window_mode; enum { @@ -143,7 +143,7 @@ void main() } while (drag_mouse.lkm); } if (m.pkm) && (m.y > skin.h) - notify("'Pixies Player v1.01\nChange sound volume: Left/Right key\nChange skin: F1/F2\nMute: M key' -St\n"); + notify("'Pixies Player v1.1\nChange sound volume: Left/Right key\nChange skin: F1/F2\nMute: M key' -St\n"); break; case evButton: @@ -161,21 +161,32 @@ void main() if (window_mode == WINDOW_MODE_NORMAL) { window_mode = WINDOW_MODE_SMALL; + win_x_normal = Form.left; + win_y_normal = Form.top; MoveSize(OLD, OLD, 99, skin.h - 1); - MoveSize(OLD, GetClientHeight() - skin.h + 1, OLD, OLD); - MoveSize(2000, OLD, OLD, OLD); + MoveSize(OLD, win_y_small, OLD, OLD); + MoveSize(win_x_small, OLD, OLD, OLD); } else { window_mode = WINDOW_MODE_NORMAL; - MoveSize(30,80,skin.w -1 ,skin.h + list.h); + win_x_small = Form.left; + win_y_small = Form.top; + MoveSize(win_x_normal, win_y_normal, skin.w -1 ,skin.h + list.h); } break; case BUTTON_PLAYBACK_PREV: - if (list.KeyUp()) StartPlayingMp3(); + if (list.KeyUp()) { + current_playing_file_n = list.current; + StartPlayingMp3(); + } break; case BUTTON_PLAYBACK_NEXT: - if (list.KeyDown()) StartPlayingMp3(); + if (list.KeyDown()) + { + current_playing_file_n = list.current; + StartPlayingMp3(); + } break; case BUTTON_PLAYBACK_PLAY_PAUSE: if (playback_mode == PLAYBACK_MODE_PLAYING) @@ -210,8 +221,8 @@ void main() break; case evReDraw: - if (window_mode == WINDOW_MODE_NORMAL) DefineAndDrawWindow(win_x, win_y, skin.w - 1, skin.h + list.h, 0x01,0,0,0); - if (window_mode == WINDOW_MODE_SMALL) DefineAndDrawWindow(win_x, win_y, 99, skin.h - 1, 0x01,0,0,0); + if (window_mode == WINDOW_MODE_NORMAL) DefineAndDrawWindow(win_x_normal, win_y_normal, skin.w - 1, skin.h + list.h, 0x01,0,0,0); + if (window_mode == WINDOW_MODE_SMALL) DefineAndDrawWindow(win_x_small, win_y_small, 99, skin.h - 1, 0x01,0,0,0); DrawWindow(); break; @@ -220,13 +231,8 @@ void main() { if (current_playing_file_n < list.count) { - //пиздец тут быдлокод пошёл - id = list.current; - current_playing_file_n++; - list.current = current_playing_file_n; + current_playing_file_n = list.current; StartPlayingMp3(); - list.current = id; - DrawPlayList(); } else { diff --git a/programs/cmm/pixie/settings.h b/programs/cmm/pixie/settings.h index feaecc1df6..ebe3da4c91 100644 --- a/programs/cmm/pixie/settings.h +++ b/programs/cmm/pixie/settings.h @@ -1,29 +1,36 @@ void LoadIniConfig() { - debugln(#pixie_ini_path); - ini_get_int stdcall (#pixie_ini_path, "Config", "current_theme", THEME_DARK); - current_theme = EAX; - if (current_theme == THEME_DARK) SetColorThemeDark(); else SetColorThemeLight(); - - ini_get_int stdcall (#pixie_ini_path, "Config", "window_mode", WINDOW_MODE_NORMAL); - window_mode = EAX; - - ini_get_int stdcall (#pixie_ini_path, "Config", "win_x", 100); - win_x = EAX; - - ini_get_int stdcall (#pixie_ini_path, "Config", "win_y", 90); - win_y = EAX; - + ini_get_int stdcall (#pixie_ini_path, "Config", "current_theme", THEME_DARK); current_theme = EAX; + ini_get_int stdcall (#pixie_ini_path, "Config", "window_mode", WINDOW_MODE_NORMAL); window_mode = EAX; + ini_get_int stdcall (#pixie_ini_path, "Config", "win_x_normal", 100); win_x_normal = EAX; + ini_get_int stdcall (#pixie_ini_path, "Config", "win_y_normal", 90); win_y_normal = EAX; + ini_get_int stdcall (#pixie_ini_path, "Config", "win_x_small", -1); win_x_small = EAX; + ini_get_int stdcall (#pixie_ini_path, "Config", "win_y_small", -1); win_y_small = EAX; ini_get_str stdcall (#pixie_ini_path, "Config", "last_folder", #work_folder, sizeof(work_folder), 0); + + if (current_theme == THEME_DARK) SetColorThemeDark(); else SetColorThemeLight(); + if (win_x_small==-1) win_x_small = 2000; + if (win_y_small==-1) win_y_small = GetClientHeight() - skin.h + 1; } void SaveIniConfig() { - debugln(#pixie_ini_path); + if (window_mode == WINDOW_MODE_NORMAL) + { + win_x_normal = Form.left; + win_y_normal = Form.top; + } + if (window_mode == WINDOW_MODE_SMALL) + { + win_x_small = Form.left; + win_y_small = Form.top; + } ini_set_int stdcall (#pixie_ini_path, "Config", "current_theme", current_theme); ini_set_int stdcall (#pixie_ini_path, "Config", "window_mode", window_mode); - ini_set_int stdcall (#pixie_ini_path, "Config", "win_x", Form.left); - ini_set_int stdcall (#pixie_ini_path, "Config", "win_y", Form.top); + ini_set_int stdcall (#pixie_ini_path, "Config", "win_x_normal", win_x_normal); + ini_set_int stdcall (#pixie_ini_path, "Config", "win_y_normal", win_y_normal); + ini_set_int stdcall (#pixie_ini_path, "Config", "win_x_small", win_x_small); + ini_set_int stdcall (#pixie_ini_path, "Config", "win_y_small", win_y_small); ini_set_str stdcall (#pixie_ini_path, "Config", "last_folder", #work_folder, strlen(#work_folder)); }