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
This commit is contained in:
Kirill Lipatov (Leency) 2015-03-08 14:39:42 +00:00
parent 6ac8497380
commit b7d84b4904
3 changed files with 47 additions and 34 deletions

View File

@ -533,7 +533,7 @@ void ProcessLinks(int id)
if (UrlExtIs(".png")==1) || (UrlExtIs(".gif")==1) || (UrlExtIs(".jpg")==1) || (UrlExtIs(".zip")==1) if (UrlExtIs(".png")==1) || (UrlExtIs(".gif")==1) || (UrlExtIs(".jpg")==1) || (UrlExtIs(".zip")==1)
|| (UrlExtIs(".7z")==1) || (UrlExtIs("netcfg")==1) || (UrlExtIs(".7z")==1) || (UrlExtIs("netcfg")==1)
{ {
notify(#URL); //notify(#URL);
if (strcmpn(#URL,"http://:", 8)==0) if (strcmpn(#URL,"http://:", 8)==0)
{ {
strcpy(#DL_URL, #URL); strcpy(#DL_URL, #URL);

View File

@ -1,5 +1,4 @@
//flac //flac
//open last folder at start up
//do not open multiple threads //do not open multiple threads
//edit list manually //edit list manually
@ -41,7 +40,8 @@ int player_run_id,
int current_playing_file_n; 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; byte window_mode;
enum { enum {
@ -143,7 +143,7 @@ void main()
} while (drag_mouse.lkm); } while (drag_mouse.lkm);
} }
if (m.pkm) && (m.y > skin.h) 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; break;
case evButton: case evButton:
@ -161,21 +161,32 @@ void main()
if (window_mode == WINDOW_MODE_NORMAL) if (window_mode == WINDOW_MODE_NORMAL)
{ {
window_mode = WINDOW_MODE_SMALL; window_mode = WINDOW_MODE_SMALL;
win_x_normal = Form.left;
win_y_normal = Form.top;
MoveSize(OLD, OLD, 99, skin.h - 1); MoveSize(OLD, OLD, 99, skin.h - 1);
MoveSize(OLD, GetClientHeight() - skin.h + 1, OLD, OLD); MoveSize(OLD, win_y_small, OLD, OLD);
MoveSize(2000, OLD, OLD, OLD); MoveSize(win_x_small, OLD, OLD, OLD);
} }
else else
{ {
window_mode = WINDOW_MODE_NORMAL; 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; break;
case BUTTON_PLAYBACK_PREV: case BUTTON_PLAYBACK_PREV:
if (list.KeyUp()) StartPlayingMp3(); if (list.KeyUp()) {
current_playing_file_n = list.current;
StartPlayingMp3();
}
break; break;
case BUTTON_PLAYBACK_NEXT: case BUTTON_PLAYBACK_NEXT:
if (list.KeyDown()) StartPlayingMp3(); if (list.KeyDown())
{
current_playing_file_n = list.current;
StartPlayingMp3();
}
break; break;
case BUTTON_PLAYBACK_PLAY_PAUSE: case BUTTON_PLAYBACK_PLAY_PAUSE:
if (playback_mode == PLAYBACK_MODE_PLAYING) if (playback_mode == PLAYBACK_MODE_PLAYING)
@ -210,8 +221,8 @@ void main()
break; break;
case evReDraw: 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_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, win_y, 99, skin.h - 1, 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(); DrawWindow();
break; break;
@ -220,13 +231,8 @@ void main()
{ {
if (current_playing_file_n < list.count) if (current_playing_file_n < list.count)
{ {
//пиздец тут быдлокод пошёл current_playing_file_n = list.current;
id = list.current;
current_playing_file_n++;
list.current = current_playing_file_n;
StartPlayingMp3(); StartPlayingMp3();
list.current = id;
DrawPlayList();
} }
else else
{ {

View File

@ -1,29 +1,36 @@
void LoadIniConfig() void LoadIniConfig()
{ {
debugln(#pixie_ini_path); ini_get_int stdcall (#pixie_ini_path, "Config", "current_theme", THEME_DARK); current_theme = EAX;
ini_get_int stdcall (#pixie_ini_path, "Config", "current_theme", THEME_DARK); ini_get_int stdcall (#pixie_ini_path, "Config", "window_mode", WINDOW_MODE_NORMAL); window_mode = EAX;
current_theme = EAX; ini_get_int stdcall (#pixie_ini_path, "Config", "win_x_normal", 100); win_x_normal = EAX;
if (current_theme == THEME_DARK) SetColorThemeDark(); else SetColorThemeLight(); 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", "window_mode", WINDOW_MODE_NORMAL); ini_get_int stdcall (#pixie_ini_path, "Config", "win_y_small", -1); win_y_small = EAX;
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_str stdcall (#pixie_ini_path, "Config", "last_folder", #work_folder, sizeof(work_folder), 0); 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() 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", "current_theme", current_theme);
ini_set_int stdcall (#pixie_ini_path, "Config", "window_mode", window_mode); 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_x_normal", win_x_normal);
ini_set_int stdcall (#pixie_ini_path, "Config", "win_y", Form.top); 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)); ini_set_str stdcall (#pixie_ini_path, "Config", "last_folder", #work_folder, strlen(#work_folder));
} }