diff --git a/0.71_My_PuTTY/config.c b/0.71_My_PuTTY/config.c index cf27fb0..3bc211e 100644 --- a/0.71_My_PuTTY/config.c +++ b/0.71_My_PuTTY/config.c @@ -2584,11 +2584,21 @@ void setup_config_box(struct controlbox *b, bool midsession, conf_radiobutton_bool_handler, I(CONF_bksp_is_delete), "Control-H", I(0), "Control-? (127)", I(1), NULL); +#ifdef PERSOPORT + ctrl_radiobuttons(s, "The Home and End keys", 'e', 3, + HELPCTX(keyboard_homeend), + conf_radiobutton_handler, + I(CONF_rxvt_homeend), + "Standard", I(0), "rxvt", I(1), "urxvt", I(2), + "xterm", I(3), "FreeBSD1", I(4), "FreeBSD2", I(5), + NULL); +#else ctrl_radiobuttons(s, "The Home and End keys", 'e', 2, HELPCTX(keyboard_homeend), conf_radiobutton_bool_handler, I(CONF_rxvt_homeend), "Standard", I(false), "rxvt", I(true), NULL); +#endif ctrl_radiobuttons(s, "The Function keys and keypad", 'f', 3, HELPCTX(keyboard_funkeys), conf_radiobutton_handler, diff --git a/0.71_My_PuTTY/putty.h b/0.71_My_PuTTY/putty.h index 32c25cb..66c8814 100644 --- a/0.71_My_PuTTY/putty.h +++ b/0.71_My_PuTTY/putty.h @@ -1373,7 +1373,11 @@ NORETURN void cleanup_exit(int); X(INT, NONE, serflow) /* SER_FLOW_NONE, SER_FLOW_XONXOFF, ... */ \ /* Keyboard options */ \ X(BOOL, NONE, bksp_is_delete) \ - X(BOOL, NONE, rxvt_homeend) \ +/* #ifdef PERSOPORT */ \ + X(INT, NONE, rxvt_homeend) \ +/* #else */ \ +/* X(BOOL, NONE, rxvt_homeend) */\ +/* #endif */ \ X(INT, NONE, funky_type) /* FUNKY_XTERM, FUNKY_LINUX, ... */ \ X(BOOL, NONE, no_applic_c) /* totally disable app cursor keys */ \ X(BOOL, NONE, no_applic_k) /* totally disable app keypad */ \ @@ -1540,7 +1544,7 @@ NORETURN void cleanup_exit(int); X(INT, NONE, sendtotray) \ X(INT, NONE, maximize) \ X(INT, NONE, fullscreen) \ - X(INT, NONE, saveonexit) \ + X(BOOL, NONE, saveonexit) \ X(INT, NONE, icone) \ X(FILENAME, NONE, iconefile) \ X(STR, NONE, sftpconnect) \ diff --git a/0.71_My_PuTTY/settings.c b/0.71_My_PuTTY/settings.c index 81ebcfc..080192f 100644 --- a/0.71_My_PuTTY/settings.c +++ b/0.71_My_PuTTY/settings.c @@ -635,7 +635,11 @@ void save_open_settings(settings_w *sesskey, Conf *conf) write_setting_b(sesskey, "RFCEnviron", conf_get_bool(conf, CONF_rfc_environ)); write_setting_b(sesskey, "PassiveTelnet", conf_get_bool(conf, CONF_passive_telnet)); write_setting_b(sesskey, "BackspaceIsDelete", conf_get_bool(conf, CONF_bksp_is_delete)); +#ifdef PERSOPORT + write_setting_i(sesskey, "RXVTHomeEnd", conf_get_int(conf, CONF_rxvt_homeend)); +#else write_setting_b(sesskey, "RXVTHomeEnd", conf_get_bool(conf, CONF_rxvt_homeend)); +#endif write_setting_i(sesskey, "LinuxFunctionKeys", conf_get_int(conf, CONF_funky_type)); write_setting_b(sesskey, "NoApplicationKeys", conf_get_bool(conf, CONF_no_applic_k)); write_setting_b(sesskey, "NoApplicationCursors", conf_get_bool(conf, CONF_no_applic_c)); @@ -878,7 +882,7 @@ void save_open_settings(settings_w *sesskey, Conf *conf) write_setting_i(sesskey, "SendToTray", conf_get_int(conf, CONF_sendtotray) ); write_setting_i(sesskey, "Maximize", conf_get_int(conf, CONF_maximize) ); write_setting_i(sesskey, "Fullscreen", conf_get_int(conf, CONF_fullscreen) ); - write_setting_i(sesskey, "SaveOnExit", conf_get_int(conf, CONF_saveonexit) ); + write_setting_b(sesskey, "SaveOnExit", conf_get_bool(conf, CONF_saveonexit) ); write_setting_i(sesskey, "Icone", conf_get_int(conf, CONF_icone) ); write_setting_filename(sesskey, "IconeFile", conf_get_filename(conf, CONF_iconefile) ); write_setting_s(sesskey, "SFTPConnect", conf_get_str(conf, CONF_sftpconnect) ); @@ -1176,7 +1180,11 @@ void load_open_settings(settings_r *sesskey, Conf *conf) gppb(sesskey, "RFCEnviron", false, conf, CONF_rfc_environ); gppb(sesskey, "PassiveTelnet", false, conf, CONF_passive_telnet); gppb(sesskey, "BackspaceIsDelete", true, conf, CONF_bksp_is_delete); +#ifdef PERSOPORT + gppi(sesskey, "RXVTHomeEnd", 0, conf, CONF_rxvt_homeend); +#else gppb(sesskey, "RXVTHomeEnd", false, conf, CONF_rxvt_homeend); +#endif gppi(sesskey, "LinuxFunctionKeys", 0, conf, CONF_funky_type); gppb(sesskey, "NoApplicationKeys", false, conf, CONF_no_applic_k); gppb(sesskey, "NoApplicationCursors", false, conf, CONF_no_applic_c); @@ -1509,7 +1517,7 @@ void load_open_settings(settings_r *sesskey, Conf *conf) gppi(sesskey, "SendToTray", 0, conf, CONF_sendtotray ); gppi(sesskey, "Maximize", 0, conf, CONF_maximize ); gppi(sesskey, "Fullscreen", 0, conf, CONF_fullscreen ); - gppi(sesskey, "SaveOnExit", 0, conf, CONF_saveonexit ); + gppb(sesskey, "SaveOnExit", false, conf, CONF_saveonexit ); gppi(sesskey, "Icone", 1, conf, CONF_icone ); gppfile(sesskey, "IconeFile", conf, CONF_iconefile ); gpps(sesskey, "SFTPConnect", "", conf, CONF_sftpconnect ); diff --git a/0.71_My_PuTTY/terminal.c b/0.71_My_PuTTY/terminal.c index be78ecc..a6bf617 100644 --- a/0.71_My_PuTTY/terminal.c +++ b/0.71_My_PuTTY/terminal.c @@ -1518,7 +1518,11 @@ void term_copy_stuff_from_conf(Terminal *term) term->utf8linedraw = conf_get_bool(term->conf, CONF_utf8linedraw); term->rect_select = conf_get_bool(term->conf, CONF_rect_select); term->remote_qtitle_action = conf_get_int(term->conf, CONF_remote_qtitle_action); +#ifdef PERSOPORT + term->rxvt_homeend = conf_get_int(term->conf, CONF_rxvt_homeend); +#else term->rxvt_homeend = conf_get_bool(term->conf, CONF_rxvt_homeend); +#endif term->scroll_on_disp = conf_get_bool(term->conf, CONF_scroll_on_disp); term->scroll_on_key = conf_get_bool(term->conf, CONF_scroll_on_key); term->xterm_256_colour = conf_get_bool(term->conf, CONF_xterm_256_colour); diff --git a/0.71_My_PuTTY/terminal.h b/0.71_My_PuTTY/terminal.h index 3cd4a40..f1c5b23 100644 --- a/0.71_My_PuTTY/terminal.h +++ b/0.71_My_PuTTY/terminal.h @@ -335,7 +335,11 @@ struct terminal_tag { bool utf8linedraw; bool rect_select; int remote_qtitle_action; +#ifdef PERSOPORT + int rxvt_homeend; +#else bool rxvt_homeend; +#endif bool scroll_on_disp; bool scroll_on_key; bool xterm_256_colour; diff --git a/0.71_My_PuTTY/windows/wincfg.c b/0.71_My_PuTTY/windows/wincfg.c index cb349e6..bf37acf 100644 --- a/0.71_My_PuTTY/windows/wincfg.c +++ b/0.71_My_PuTTY/windows/wincfg.c @@ -82,13 +82,12 @@ static void behaviour_handler(union control *ctrl, dlgparam *dlg, dlg_control_enable(wbd->window_minimizable, dlg, conf_get_int(conf,CONF_window_has_sysmenu)); dlg_checkbox_set(wbd->window_maximizable, dlg, conf_get_int(conf,CONF_window_has_sysmenu) ? conf_get_int(conf,CONF_window_maximizable) : 0); dlg_control_enable(wbd->window_maximizable, dlg, conf_get_int(conf,CONF_window_has_sysmenu)); - dlg_checkbox_set(wbd->sysmenu_alt_space, dlg, conf_get_int(conf,CONF_window_has_sysmenu) ? conf_get_int(conf,CONF_alt_space) : 0); + dlg_checkbox_set(wbd->sysmenu_alt_space, dlg, conf_get_int(conf,CONF_window_has_sysmenu) ? conf_get_bool(conf,CONF_alt_space) : 0); dlg_control_enable(wbd->sysmenu_alt_space, dlg, conf_get_int(conf,CONF_window_has_sysmenu)); - dlg_checkbox_set(wbd->sysmenu_alt_only, dlg, conf_get_int(conf,CONF_window_has_sysmenu) ? conf_get_int(conf,CONF_alt_only) : 0); + dlg_checkbox_set(wbd->sysmenu_alt_only, dlg, conf_get_int(conf,CONF_window_has_sysmenu) ? conf_get_bool(conf,CONF_alt_only) : 0); dlg_control_enable(wbd->sysmenu_alt_only, dlg, conf_get_int(conf,CONF_window_has_sysmenu)); dlg_update_done(ctrl, dlg); } else if (event == EVENT_VALCHANGE) { - //cfg->window_has_sysmenu = dlg_checkbox_get(ctrl, dlg); conf_set_int(conf,CONF_window_has_sysmenu, dlg_checkbox_get(ctrl, dlg)); dlg_refresh(ctrl, dlg); }; @@ -98,7 +97,6 @@ static void behaviour_handler(union control *ctrl, dlgparam *dlg, dlg_checkbox_set(ctrl, dlg, conf_get_int(conf,CONF_window_has_sysmenu) ? conf_get_int(conf,CONF_window_closable) : 0); dlg_update_done(ctrl, dlg); } else if (event == EVENT_VALCHANGE) - //cfg->window_closable = dlg_checkbox_get(ctrl, dlg); conf_set_int(conf,CONF_window_closable, dlg_checkbox_get(ctrl, dlg)); } else if (ctrl == wbd->window_minimizable) { if (event == EVENT_REFRESH) { @@ -106,7 +104,6 @@ static void behaviour_handler(union control *ctrl, dlgparam *dlg, dlg_checkbox_set(ctrl, dlg, conf_get_int(conf,CONF_window_has_sysmenu) ? conf_get_int(conf,CONF_window_minimizable) : 0); dlg_update_done(ctrl, dlg); } else if (event == EVENT_VALCHANGE) - //cfg->window_minimizable = dlg_checkbox_get(ctrl, dlg); conf_set_int(conf,CONF_window_minimizable,dlg_checkbox_get(ctrl, dlg)); } else if (ctrl == wbd->window_maximizable) { if (event == EVENT_REFRESH) { @@ -114,24 +111,21 @@ static void behaviour_handler(union control *ctrl, dlgparam *dlg, dlg_checkbox_set(ctrl, dlg, conf_get_int(conf,CONF_window_has_sysmenu) ? conf_get_int(conf,CONF_window_maximizable) : 0); dlg_update_done(ctrl, dlg); } else if (event == EVENT_VALCHANGE) - //cfg->window_maximizable = dlg_checkbox_get(ctrl, dlg); conf_set_int(conf,CONF_window_maximizable,dlg_checkbox_get(ctrl, dlg)); } else if (ctrl == wbd->sysmenu_alt_space) { if (event == EVENT_REFRESH) { dlg_update_start(ctrl, dlg); - dlg_checkbox_set(ctrl, dlg, conf_get_int(conf,CONF_window_has_sysmenu) ? conf_get_int(conf,CONF_alt_space) : 0); + dlg_checkbox_set(ctrl, dlg, conf_get_int(conf,CONF_window_has_sysmenu) ? conf_get_bool(conf,CONF_alt_space) : 0); dlg_update_done(ctrl, dlg); } else if (event == EVENT_VALCHANGE) - //cfg->alt_space = dlg_checkbox_get(ctrl, dlg); conf_set_int(conf,CONF_alt_space, dlg_checkbox_get(ctrl, dlg)); } else if (ctrl == wbd->sysmenu_alt_only) { if (event == EVENT_REFRESH) { dlg_update_start(ctrl, dlg); - dlg_checkbox_set(ctrl, dlg, conf_get_int(conf,CONF_window_has_sysmenu) ? conf_get_int(conf,CONF_alt_only) : 0); + dlg_checkbox_set(ctrl, dlg, conf_get_int(conf,CONF_window_has_sysmenu) ? conf_get_bool(conf,CONF_alt_only) : 0); dlg_update_done(ctrl, dlg); } else if (event == EVENT_VALCHANGE) - //cfg->alt_only = dlg_checkbox_get(ctrl, dlg); - conf_set_int(conf,CONF_alt_only,dlg_checkbox_get(ctrl, dlg)); + conf_set_bool(conf,CONF_alt_only,dlg_checkbox_get(ctrl, dlg)); } } #endif diff --git a/0.71_My_PuTTY/windows/window.c b/0.71_My_PuTTY/windows/window.c index 81f41fd..54727d6 100644 --- a/0.71_My_PuTTY/windows/window.c +++ b/0.71_My_PuTTY/windows/window.c @@ -886,7 +886,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) conf_set_filename( conf, CONF_logfilename,filename_from_str(argv[i])) ; conf_set_int( conf, CONF_logtype,1 ) ; conf_set_int( conf, CONF_logxfovr,1 ) ; - conf_set_int( conf, CONF_logflush,1 ) ; + conf_set_bool( conf, CONF_logflush, true ) ; } else if( !strcmp(p, "-nofiles") ) { SetNoKittyFileFlag( 1 ) ; } else if( !strcmp(p, "-edit") ) { @@ -968,14 +968,14 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) if( atoi(argv[i])>=0 ) { conf_set_int( conf, CONF_xpos,atoi(argv[i])); if( conf_get_int( conf, CONF_ypos)<0 ) conf_set_int( conf, CONF_ypos,0); - conf_set_int( conf, CONF_save_windowpos, 1 ) ; + conf_set_bool( conf, CONF_save_windowpos, true ) ; } } else if( !strcmp(p, "-ypos") ) { i++ ; if( atoi(argv[i])>=0 ) { conf_set_int( conf, CONF_ypos, atoi(argv[i])); if( conf_get_int( conf, CONF_xpos)<0) conf_set_int( conf, CONF_xpos,0); - conf_set_int( conf, CONF_save_windowpos,1); + conf_set_bool( conf, CONF_save_windowpos, true ) ; } #if (defined IMAGEPORT) && (!defined FDJ) } else if( !strcmp(p, "-nobgimage") ) { @@ -1178,7 +1178,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) icon = LoadIcon(inst, MAKEINTRESOURCE(IDI_MAINICON)); #ifdef PERSOPORT int xpos_init=0, ypos_init=0 ; - if( (conf_get_int(conf,CONF_saveonexit)||conf_get_int(conf,CONF_save_windowpos)) + if( (conf_get_bool(conf,CONF_saveonexit)||conf_get_bool(conf,CONF_save_windowpos)) && (conf_get_int(conf,CONF_xpos)>=0) && (conf_get_int(conf,CONF_ypos)>=0) ) { xpos_init=conf_get_int(conf,CONF_xpos) ; ypos_init=conf_get_int(conf,CONF_ypos) ; @@ -1378,7 +1378,7 @@ TrayIcone.hWnd = hwnd ; SWP_NOMOVE | SWP_NOREDRAW | SWP_NOZORDER); #ifdef PERSOPORT if( !PuttyFlag ) - if( (conf_get_int(conf,CONF_saveonexit)||conf_get_int(conf,CONF_save_windowpos)) + if( (conf_get_bool(conf,CONF_saveonexit)||conf_get_bool(conf,CONF_save_windowpos)) && (xpos_init>=0) && (ypos_init>=0) ) { MoveWindow(hwnd, xpos_init, ypos_init, guess_width, guess_height, TRUE ); } @@ -1478,7 +1478,7 @@ TrayIcone.hWnd = hwnd ; // if( !IsWow64() ) { AppendMenu(m, MF_ENABLED, IDM_PRINT, "Print clip&board") ; } // Le menu print clipboard avait été desactivé un temps sur les machine 64bits AppendMenu(m, MF_ENABLED, IDM_PRINT, "Print clip&board") ; AppendMenu(m, MF_ENABLED, IDM_TOTRAY, "Send to tra&y"); - if( conf_get_int(conf,CONF_alwaysontop)/*cfg.alwaysontop*/ ) + if( conf_get_bool(conf,CONF_alwaysontop) ) AppendMenu(m, MF_ENABLED|MF_CHECKED, IDM_VISIBLE, "Always visi&ble"); else AppendMenu(m, MF_ENABLED, IDM_VISIBLE, "Always visi&ble"); @@ -1788,7 +1788,7 @@ void cleanup_exit(int code) */ #ifdef PERSOPORT chdir( InitialDirectory ) ; - if( conf_get_int(conf,CONF_saveonexit)/*cfg.saveonexit*/ ) { SaveWindowCoord( conf/*cfg*/ ) ; } + if( conf_get_bool(conf,CONF_saveonexit) ) { SaveWindowCoord( conf ) ; } if( IniFileFlag == SAVEMODE_REG ) { // Mode de sauvegarde registry //SaveRegistryKey() ; @@ -3405,7 +3405,7 @@ else if((UINT_PTR)wParam == TIMER_LOGROTATION) { // log rotation if( !GetBackgroundImageFlag() ) conf_set_int( conf, CONF_bg_type, 0 ); #endif if( !PuttyFlag ) - if( conf_get_int( conf,CONF_saveonexit) && conf_get_int( conf,CONF_windowstate) ) + if( conf_get_bool( conf,CONF_saveonexit) && conf_get_int( conf,CONF_windowstate) ) PostMessage( hwnd, WM_SYSCOMMAND, SC_MAXIMIZE, (LPARAM)NULL ); if( conf_get_int(conf, CONF_ctrl_tab_switch) && GetCtrlTabFlag() ) { int wndExtra = GetClassLong(hwnd, GCL_CBWNDEXTRA); @@ -3449,7 +3449,7 @@ else if((UINT_PTR)wParam == TIMER_LOGROTATION) { // log rotation } else #endif /* rutty */ - if ( !conf_get_int(conf,CONF_warn_on_close) || session_closed || + if ( !conf_get_bool(conf,CONF_warn_on_close) || session_closed || MessageBox(hwnd, "Are you sure you want to close this session?", str, MB_ICONWARNING | MB_OKCANCEL | MB_DEFBUTTON1) @@ -4792,7 +4792,7 @@ else if((UINT_PTR)wParam == TIMER_LOGROTATION) { // log rotation case WM_MOVE: if( (!GetBackgroundImageFlag()) || GetPuttyFlag() ) { sys_cursor_update(); - if( conf_get_int(conf,CONF_saveonexit) ) GetWindowCoord( hwnd ) ; + if( conf_get_bool(conf,CONF_saveonexit) ) GetWindowCoord( hwnd ) ; break; } if(backgrounddc) @@ -4803,7 +4803,7 @@ else if((UINT_PTR)wParam == TIMER_LOGROTATION) { // log rotation } sys_cursor_update(); - if( conf_get_int(conf,CONF_saveonexit) ) GetWindowCoord( hwnd ) ; + if( conf_get_bool(conf,CONF_saveonexit) ) GetWindowCoord( hwnd ) ; break; @@ -4846,7 +4846,7 @@ else if((UINT_PTR)wParam == TIMER_LOGROTATION) { // log rotation #else case WM_MOVE: sys_cursor_update(); - if( conf_get_int(conf,CONF_saveonexit) ) GetWindowCoord( hwnd ) ; + if( conf_get_bool(conf,CONF_saveonexit) ) GetWindowCoord( hwnd ) ; break; #endif #else @@ -4995,7 +4995,7 @@ else if((UINT_PTR)wParam == TIMER_LOGROTATION) { // log rotation } #ifdef PERSOPORT if( GetTitleBarFlag() ) wintw_set_title( NULL, conf_get_str(conf,CONF_wintitle) ) ; // Pour refaire la barre de titre si option SizeFlag - if( conf_get_int(conf,CONF_saveonexit) ) GetWindowCoord( hwnd ) ; + if( conf_get_bool(conf,CONF_saveonexit) ) GetWindowCoord( hwnd ) ; #endif #ifdef IMAGEPORT /* @@ -6980,7 +6980,7 @@ void set_title_internal(TermWin *tw, const char *title) { sfree(window_name); window_name = snewn(1 + strlen(title), char); strcpy(window_name, title); - if (conf_get_int(conf, CONF_win_name_always) || !IsIconic(hwnd)) + if (conf_get_bool(conf, CONF_win_name_always) || !IsIconic(hwnd)) SetWindowText(hwnd, title); } @@ -7073,7 +7073,7 @@ static void wintw_set_title(TermWin *tw, const char *title_in) { if( strlen( title ) > 0 ) { if( title[strlen(title)-1] == ']' ) make_title( buffer, "%s", title ) ; else { - sprintf( fmt, "%%s [%dx%d]", conf_get_int(conf,CONF_height)/*cfg.height*/, conf_get_int(conf,CONF_width)) ; + sprintf( fmt, "%%s [%dx%d]", conf_get_int(conf,CONF_height), conf_get_int(conf,CONF_width)) ; make_title( buffer, fmt, title ) ; } } @@ -7101,7 +7101,7 @@ static void wintw_set_icon_title(TermWin *tw, const char *title2) sfree(icon_name); icon_name = snewn(1 + strlen(title), char); strcpy(icon_name, title); - if (!conf_get_int(conf,CONF_win_name_always) && IsIconic(hwnd)) + if (!conf_get_bool(conf,CONF_win_name_always) && IsIconic(hwnd)) SetWindowText(hwnd, title); } #else @@ -7954,7 +7954,7 @@ static void wintw_bell(TermWin *tw, int mode) if (!term->has_focus) { #ifdef PERSOPORT if( GetVisibleFlag()!=VISIBLE_TRAY ) { - if(conf_get_int(conf,CONF_foreground_on_bell) ) { // Tester avec sleep 4 ; echo -e '\a' + if(conf_get_bool(conf,CONF_foreground_on_bell) ) { // Tester avec sleep 4 ; echo -e '\a' if( IsIconic(hwnd) ) SwitchToThisWindow( hwnd, TRUE ) ; else SetForegroundWindow( MainHwnd ) ; } @@ -7968,7 +7968,7 @@ static void wintw_bell(TermWin *tw, int mode) else { if( conf_get_int(conf,CONF_beep_ind)==B_IND_FLASH ) flash_window(2) ; } } } else if( GetVisibleFlag()==VISIBLE_TRAY ) { - if( conf_get_int(conf,CONF_foreground_on_bell)/*cfg.foreground_on_bell*/ ) { SendMessage( MainHwnd, WM_COMMAND, IDM_FROMTRAY, 0 ); } + if( conf_get_bool(conf,CONF_foreground_on_bell) ) { SendMessage( MainHwnd, WM_COMMAND, IDM_FROMTRAY, 0 ); } else if(mode == BELL_VISUAL) SetTimer(hwnd, TIMER_BLINKTRAYICON, (int)500, NULL) ; //SendMessage( MainHwnd, WM_COMMAND, IDM_FROMTRAY, 0 ); //flash_window(2); /* start */ diff --git a/cygterm/cygterm.c b/cygterm/cygterm.c index f05eb8d..32172ab 100644 --- a/cygterm/cygterm.c +++ b/cygterm/cygterm.c @@ -491,7 +491,7 @@ makeAttributes(char *buf, Conf *conf) { char *e = buf; - if (conf_get_int(conf,CONF_bksp_is_delete)) + if (conf_get_bool(conf,CONF_bksp_is_delete)) e = strecpy(e, ":erase=^?"); else e = strecpy(e, ":erase=^H"); diff --git a/kitty.c b/kitty.c index 88a128d..649a9cb 100644 --- a/kitty.c +++ b/kitty.c @@ -2239,7 +2239,7 @@ void SendFileList( HWND hwnd, char * filelist ) { void SendFile( HWND hwnd ) { char filename[32768] ; - if( conf_get_int(conf,CONF_protocol)/*cfg.protocol*/ != PROT_SSH ) { + if( conf_get_int(conf,CONF_protocol) != PROT_SSH ) { MessageBox( hwnd, "This function is only available with SSH connections.", "Error", MB_OK|MB_ICONERROR ) ; return ; } @@ -2428,7 +2428,7 @@ void GetFile( HWND hwnd ) { char dir[4096], pscppath[4096]="", pscpport[4096]="22" ; int p; - if( conf_get_int(conf,CONF_protocol)/*cfg.protocol*/ != PROT_SSH ) { + if( conf_get_int(conf,CONF_protocol) != PROT_SSH ) { MessageBox( hwnd, "This function is only available with SSH connections.", "Error", MB_OK|MB_ICONERROR ) ; return ; } @@ -2509,7 +2509,7 @@ void GetFile( HWND hwnd ) { } else { strcat( buffer, conf_get_str(conf,CONF_username) ) ; strcat( buffer, "@" ) ; - if( poss( ":", conf_get_str(conf,CONF_host))>0 ) { strcat( buffer, "[" ) ; strcat( buffer, conf_get_str(conf,CONF_host)/*cfg.host*/ ) ; strcat( buffer, "]" ) ; } + if( poss( ":", conf_get_str(conf,CONF_host))>0 ) { strcat( buffer, "[" ) ; strcat( buffer, conf_get_str(conf,CONF_host) ) ; strcat( buffer, "]" ) ; } else { strcat( buffer, conf_get_str(conf,CONF_host) ) ; } } strcat( buffer, ":" ) ; @@ -2713,7 +2713,7 @@ void GetWindowCoord( HWND hwnd ) { // Sauve les coordonnees de la fenetre void SaveWindowCoord( Conf * conf ) { char key[1024], session[1024] ; - if( conf_get_int(conf,CONF_saveonexit) ) + if( conf_get_bool(conf,CONF_saveonexit) ) if( conf_get_str(conf,CONF_sessionname)!= NULL ) if( strlen( conf_get_str(conf,CONF_sessionname) ) > 0 ) { if( IniFileFlag == SAVEMODE_REG ) { @@ -2813,7 +2813,7 @@ int PreviousBgImage( HWND hwnd ) { DIR * dir ; struct dirent * de ; - strcpy( basename, conf_get_filename(conf,CONF_bg_image_filename)/*cfg.bg_image_filename.*/->path ) ; + strcpy( basename, conf_get_filename(conf,CONF_bg_image_filename)->path ) ; for( i=(strlen(basename)-1) ; i>=0 ; i-- ) if( (basename[i]=='\\')||(basename[i]=='/') ) { basename[i]='\0' ; break ; } @@ -2825,7 +2825,7 @@ int PreviousBgImage( HWND hwnd ) { if( strcmp(de->d_name,".") && strcmp(de->d_name,"..") ) { sprintf( buffer,"%s\\%s", basename, de->d_name ) ; if( !(GetFileAttributes( buffer ) & FILE_ATTRIBUTE_DIRECTORY) ) { - if( !strcmp(buffer, conf_get_filename(conf,CONF_bg_image_filename)/*cfg.bg_image_filename.*/->path ) ) + if( !strcmp(buffer, conf_get_filename(conf,CONF_bg_image_filename)->path ) ) if( strcmp( previous, "" ) ) break ; GetExt( de->d_name, ext ) ; @@ -2836,7 +2836,7 @@ int PreviousBgImage( HWND hwnd ) { } if( strcmp( previous, "" ) ){ Filename * fn = filename_from_str( previous ) ; - conf_set_filename(conf,CONF_bg_image_filename,fn); //strcpy( cfg.bg_image_filename.path, previous ) ; + conf_set_filename(conf,CONF_bg_image_filename,fn); filename_free(fn); RefreshBackground( hwnd ) ; } @@ -2849,7 +2849,7 @@ int NextBgImage( HWND hwnd ) { DIR * dir ; struct dirent * de ; - strcpy( basename, conf_get_filename(conf,CONF_bg_image_filename)/*cfg.bg_image_filename.*/->path ) ; + strcpy( basename, conf_get_filename(conf,CONF_bg_image_filename)->path ) ; for( i=(strlen(basename)-1) ; i>=0 ; i-- ) if( (basename[i]=='\\')||(basename[i]=='/') ) { basename[i]='\0' ; break ; } @@ -2865,7 +2865,7 @@ int NextBgImage( HWND hwnd ) { ) { sprintf( buffer,"%s\\%s", basename, de->d_name ) ; if( !(GetFileAttributes( buffer ) & FILE_ATTRIBUTE_DIRECTORY) ) { - if( !stricmp( buffer, conf_get_filename(conf,CONF_bg_image_filename)/*cfg.bg_image_filename.*/->path ) ) { + if( !stricmp( buffer, conf_get_filename(conf,CONF_bg_image_filename)->path ) ) { if( ( de = readdir(dir) ) != NULL ) GetExt( de->d_name, ext ) ; else @@ -2891,7 +2891,7 @@ int NextBgImage( HWND hwnd ) { if( de != NULL ) { sprintf( buffer,"%s\\%s", basename, de->d_name ) ; Filename * fn = filename_from_str( buffer ) ; - conf_set_filename( conf,CONF_bg_image_filename,fn); //strcpy( cfg.bg_image_filename.path, buffer ) ; + conf_set_filename( conf,CONF_bg_image_filename,fn); filename_free(fn); RefreshBackground( hwnd ); } @@ -3085,7 +3085,7 @@ static LRESULT CALLBACK InputMultilineCallBack (HWND hwnd, UINT message, WPARAM case WM_INITDIALOG: { char * buffer ; buffer=(char*)malloc(1024); - sprintf( buffer, "%s - Text input", conf_get_str(conf,CONF_wintitle)/*cfg.wintitle*/ ) ; + sprintf( buffer, "%s - Text input", conf_get_str(conf,CONF_wintitle) ) ; SetWindowText( hwnd, buffer ) ; free(buffer); handle = GetDlgItem(hwnd,IDC_RESULT) ; @@ -3630,7 +3630,6 @@ int InternalCommand( HWND hwnd, char * st ) { #ifdef SAVEDUMPPORT else if( !strcmp( st, "/savedump" ) ) { SaveDump() ; return 1 ; } #endif -#if (defined IMAGEPORT) && (!defined FDJ) else if( !strcmp( st, "/screenshot" ) ) { char screenShotFile[1024] ; sprintf( screenShotFile, "%s\\screenshot-%d-%ld.jpg", InitialDirectory, getpid(), time(0) ); @@ -3639,7 +3638,6 @@ int InternalCommand( HWND hwnd, char * st ) { //screenCaptureAll( screenShotFile, 100 ) ; //MakeScreenShot() ; return 1 ; } -#endif else if( !strcmp( st, "/fileassoc" ) ) { CreateFileAssoc() ; return 1 ; } else if( !strcmp( st, "/savereg" ) ) { chdir( InitialDirectory ) ; SaveRegistryKey() ; return 1 ; } else if( !strcmp( st, "/savesessions" ) ) { @@ -3658,7 +3656,7 @@ int InternalCommand( HWND hwnd, char * st ) { else if( !strcmp( st, "/icon" ) ) { //sprintf( buffer, "%d / %d = %d", IconeNum, NB_ICONES, NumberOfIcons ); //MessageBox( hwnd, buffer, "info", MB_OK ) ; - IconeFlag = abs( IconeFlag - 1 ) ; conf_set_int(conf,CONF_icone,IconeNum) /*cfg.icone = IconeNum*/ ; return 1 ; } + IconeFlag = abs( IconeFlag - 1 ) ; conf_set_int(conf,CONF_icone,IconeNum) ; return 1 ; } else if( !strcmp( st, "/savemode" ) ) { //IniFileFlag = abs( IniFileFlag - 1 ) ; IniFileFlag++ ; if( IniFileFlag>SAVEMODE_DIR ) IniFileFlag = 0 ; @@ -3690,15 +3688,14 @@ int InternalCommand( HWND hwnd, char * st ) { SetWindowPos( hwnd, 0, 10, 10, 0, 0, SWP_NOSIZE|SWP_NOZORDER|SWP_NOOWNERZORDER|SWP_NOACTIVATE ) ; return 1 ; } - else if( !strcmp( st, "/size" ) ) { SizeFlag = abs( SizeFlag - 1 ) ; set_title( NULL, conf_get_str(conf,CONF_wintitle)/*cfg.wintitle*/ ) ; return 1 ; } + else if( !strcmp( st, "/size" ) ) { SizeFlag = abs( SizeFlag - 1 ) ; set_title( NULL, conf_get_str(conf,CONF_wintitle) ) ; return 1 ; } else if( !strcmp( st, "/transparency" ) ) { #ifndef NO_TRANSPARENCY if( (conf_get_int(conf,CONF_transparencynumber) == -1) || (TransparencyFlag == 0 ) ) { TransparencyFlag = 1 ; SetWindowLongPtr(MainHwnd, GWL_EXSTYLE, GetWindowLong(MainHwnd, GWL_EXSTYLE) | WS_EX_LAYERED ) ; SetWindowPos( MainHwnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER ) ; - if( conf_get_int(conf,CONF_transparencynumber) == -1 ) conf_set_int(conf,CONF_transparencynumber,0) ; //cfg.transparencynumber = 0 ; - //SetLayeredWindowAttributes(hwnd, 0, TransparencyNumber, LWA_ALPHA) ; + if( conf_get_int(conf,CONF_transparencynumber) == -1 ) conf_set_int(conf,CONF_transparencynumber,0) ; SetTransparency( MainHwnd, 255-conf_get_int(conf,CONF_transparencynumber) ) ; SetForegroundWindow( hwnd ) ; } @@ -3717,9 +3714,9 @@ int InternalCommand( HWND hwnd, char * st ) { else if( strstr( st, "/bcdelay " ) == st ) { between_char_delay=atoi( st+9 ) ; return 1 ; } else if( strstr( st, "/title " ) == st ) { set_title( NULL, st+7 ) ; return 1 ; } else if( !strcmp( st, "/session" ) ) { - if( strlen( conf_get_str(conf,CONF_sessionname) /*cfg.sessionname*/ ) > 0 ) { + if( strlen( conf_get_str(conf,CONF_sessionname) ) > 0 ) { char buffer[1024] ; - sprintf( buffer, "Your session name is\n-%s-", conf_get_str(conf,CONF_sessionname) /*cfg.sessionname*/ ) ; + sprintf( buffer, "Your session name is\n-%s-", conf_get_str(conf,CONF_sessionname) ) ; MessageBox( hwnd, buffer, "Session name", MB_OK|MB_ICONWARNING ) ; } else @@ -3783,7 +3780,7 @@ int InternalCommand( HWND hwnd, char * st ) { else if( !strcmp( st, "/winroll" ) ) { WinrolFlag = abs(WinrolFlag-1) ; return 1 ; } else if( !strcmp( st, "/wintitle" ) ) { TitleBarFlag = abs(TitleBarFlag-1) ; return 1 ; } else if( strstr( st, "/command " ) == st ) { SendCommandAllWindows( hwnd, st+9 ) ; return 1 ; } - else if( !strcmp( st, "/sizeall" ) ) { ResizeWinList( hwnd, conf_get_int(conf,CONF_width)/*cfg.width*/, conf_get_int(conf,CONF_height)/*cfg.height*/ ) ; return 1 ; } + else if( !strcmp( st, "/sizeall" ) ) { ResizeWinList( hwnd, conf_get_int(conf,CONF_width), conf_get_int(conf,CONF_height) ) ; return 1 ; } else if( !strcmp( st, "/zmodem" ) ) { ZModemFlag = abs(ZModemFlag-1) ; } return 0 ; } @@ -3895,14 +3892,7 @@ void StartNewSession( HWND hwnd, char * directory, char * host, char * user ) { strcat(cmd,"\"") ; strcat(cmd,bufpass) ; strcat(cmd,"\"") ; memset(bufpass,0,strlen(bufpass)); } - strcat( cmd, " -P " ) ; sprintf( buffer, "%d", conf_get_int(conf,CONF_port)/*cfg.port*/ ); strcat( cmd, buffer ) ; - /*if( strlen( cfg.keyfile.path ) > 0 ) { - if( GetShortPathName( cfg.keyfile.path, shortpath, 4095 ) ) { - strcat( cmd, " /privatekey=\"" ) ; - strcat( cmd, shortpath ) ; - strcat( cmd, "\"" ) ; - } - }*/ + strcat( cmd, " -P " ) ; sprintf( buffer, "%d", conf_get_int(conf,CONF_port) ); strcat( cmd, buffer ) ; } else if( conf_get_int(conf,CONF_protocol) == PROT_TELNET ){ sprintf( cmd, "%s -telnet %s", shortpath, conf_get_str(conf,CONF_username) ) ; @@ -3915,7 +3905,7 @@ void StartNewSession( HWND hwnd, char * directory, char * host, char * user ) { strcat(cmd,"\"") ; strcat(cmd,bufpass) ; strcat(cmd,"\"") ; memset(bufpass,0,strlen(bufpass)); } - strcat( cmd, " -P " ) ; sprintf( buffer, "%d", conf_get_int(conf,CONF_port)/*cfg.port*/ ); strcat( cmd, buffer ) ; + strcat( cmd, " -P " ) ; sprintf( buffer, "%d", conf_get_int(conf,CONF_port) ); strcat( cmd, buffer ) ; } if( directory!=NULL ) if( strlen(directory)>0 ) { @@ -4682,33 +4672,29 @@ void ChangeSettings(HWND hwnd) { int ManageViewer( HWND hwnd, WORD wParam ) { // Gestion du mode image if( wParam==VK_BACK ) { if( PreviousBgImage( hwnd ) ) InvalidateRect(hwnd, NULL, TRUE) ; - set_title(NULL, conf_get_str(conf,CONF_wintitle)/*cfg.wintitle*/) ; + set_title(NULL, conf_get_str(conf,CONF_wintitle) ) ; return 1 ; } else if( wParam==VK_SPACE ) { if( NextBgImage( hwnd ) ) InvalidateRect(hwnd, NULL, TRUE) ; - set_title(NULL, conf_get_str(conf,CONF_wintitle)/*cfg.wintitle*/) ; + set_title(NULL, conf_get_str(conf,CONF_wintitle)) ; return 1 ; } else if( wParam == VK_DOWN ) // Augmenter l'opacite de l'image de fond - { if( conf_get_int(conf,CONF_bg_type)/*cfg.bg_type*/ != 0 ) { + { if( conf_get_int(conf,CONF_bg_type) != 0 ) { int n=conf_get_int(conf,CONF_bg_opacity) ; n += 5 ; if( n>100 ) n = 0 ; conf_set_int( conf, CONF_bg_opacity, n ) ; - /*cfg.bg_opacity += 5 ; - if( cfg.bg_opacity>100 ) cfg.bg_opacity = 0 ;*/ RefreshBackground( hwnd ) ; return 1 ; } } else if( wParam == VK_UP ) // Diminuer l'opacite de l'image de fond - { if( conf_get_int(conf,CONF_bg_type)/*cfg.bg_type*/ != 0 ) { + { if( conf_get_int(conf,CONF_bg_type) != 0 ) { int n=conf_get_int(conf,CONF_bg_opacity) ; n -= 5 ; if( n<0 ) n = 100 ; conf_set_int( conf, CONF_bg_opacity, n ) ; - /*cfg.bg_opacity -= 5 ; - if( cfg.bg_opacity<0 ) cfg.bg_opacity = 100 ;*/ RefreshBackground( hwnd ) ; return 1 ; } @@ -4975,7 +4961,6 @@ int ManageShortcuts( HWND hwnd, const int* clips_system, int key_num, int shift_ { SendMessage( hwnd, WM_COMMAND, IDM_WINSCP, 0 ) ; return 1 ; } else if( key == shortcuts_tab.autocommand ) // Rejouer la commande de demarrage { RenewPassword( conf ) ; - //SendAutoCommand( hwnd, cfg.autocommand ) ; SetTimer(hwnd, TIMER_AUTOCOMMAND,autocommand_delay, NULL) ; return 1 ; } if( key == shortcuts_tab.print ) { // Impression presse papier @@ -4990,7 +4975,7 @@ int ManageShortcuts( HWND hwnd, const int* clips_system, int key_num, int shift_ } #endif if( key == shortcuts_tab.viewer ) // Switcher le mode visualiseur d'image - { ImageViewerFlag = abs(ImageViewerFlag-1) ; set_title(NULL, conf_get_str(conf,CONF_wintitle)/*cfg.wintitle*/) ; return 1 ; } + { ImageViewerFlag = abs(ImageViewerFlag-1) ; set_title(NULL, conf_get_str(conf,CONF_wintitle) ) ; return 1 ; } if( key == shortcuts_tab.script ) // Chargement d'un fichier de script { OpenAndSendScriptFile( hwnd ) ; return 1 ; } diff --git a/kitty_image.c b/kitty_image.c index 525b66a..8609b51 100644 --- a/kitty_image.c +++ b/kitty_image.c @@ -362,13 +362,13 @@ static BOOL load_wallpaper_bmp(HBITMAP* rawImage, int* style, int* x, int* y) static BOOL load_file_bmp(HBITMAP* rawImage, int* style, int* x, int* y) { - *x = conf_get_int( conf,CONF_bg_image_abs_x); // cfg.bg_image_abs_x; - *y = conf_get_int( conf,CONF_bg_image_abs_y ); // cfg.bg_image_abs_y; - *style = conf_get_int( conf,CONF_bg_image_style); // cfg.bg_image_style; + *x = conf_get_int( conf,CONF_bg_image_abs_x); + *y = conf_get_int( conf,CONF_bg_image_abs_y ); + *style = conf_get_int( conf,CONF_bg_image_style); if( *rawImage!=NULL ) { DeleteObject( *rawImage ) ; *rawImage=NULL ; } *rawImage = LoadImage( - NULL, conf_get_filename( conf, CONF_bg_image_filename )/*cfg.bg_image_filename.*/->path, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE + NULL, conf_get_filename( conf, CONF_bg_image_filename )->path, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE ); if(*rawImage == 0) return FALSE; // TODO: Should the error be reported to the user here? @@ -580,15 +580,15 @@ while (cinfo.output_scanline < cinfo.output_height) { static BOOL load_file_jpeg(HBITMAP* rawImage, int* style, int* x, int* y) { - *x = conf_get_int( conf, CONF_bg_image_abs_x ); // cfg.bg_image_abs_x; - *y = conf_get_int( conf, CONF_bg_image_abs_y ); // cfg.bg_image_abs_y; - *style = conf_get_int( conf, CONF_bg_image_style ); // cfg.bg_image_style; + *x = conf_get_int( conf, CONF_bg_image_abs_x ); + *y = conf_get_int( conf, CONF_bg_image_abs_y ); + *style = conf_get_int( conf, CONF_bg_image_style ); int res=TRUE, LsizeX, LsizeY ; FILE *fp ; HGLOBAL LimageBitmap = NULL ; - if( ( fp=fopen( conf_get_filename( conf,CONF_bg_image_filename)/*cfg.bg_image_filename.*/->path, "rb" ) ) == NULL ) return FALSE ; + if( ( fp=fopen( conf_get_filename( conf,CONF_bg_image_filename)->path, "rb" ) ) == NULL ) return FALSE ; if( *rawImage!=NULL ) { DeleteObject( *rawImage ) ; *rawImage=NULL ; } *rawImage = loadJPEGimage(fp, &LimageBitmap,&LsizeX, &LsizeY) ; @@ -621,46 +621,6 @@ static HBITMAP CreateDIBSectionWithFileMapping(HDC dc, int width, int height, HA /***********SCREEN CAPTURE*******************/ -int screenCapturePart(int x, int y, int w, int h, LPCSTR fname,int quality) { - int return_code = 0 ; - HDC hdcSource = GetDC(NULL); - HDC hdcMemory = CreateCompatibleDC(hdcSource); - - //int capX = GetDeviceCaps(hdcSource, HORZRES); - //int capY = GetDeviceCaps(hdcSource, VERTRES); - - HBITMAP hBitmap = CreateCompatibleBitmap(hdcSource, w, h); - HBITMAP hBitmapOld = (HBITMAP)SelectObject(hdcMemory, hBitmap); - - BitBlt(hdcMemory, 0, 0, w, h, hdcSource, x, y, SRCCOPY); - hBitmap = (HBITMAP)SelectObject(hdcMemory, hBitmapOld); - - DeleteDC(hdcSource); - DeleteDC(hdcMemory); - - //HPALETTE hpal = NULL; - if( HBITMAP_to_JPG( hBitmap,fname, quality) ) { return_code = 1 ; } - DeleteObject(hBitmap); - - return return_code ; -} -int screenCaptureClientRect( HWND hwnd, LPCSTR fname, int quality ) { - RECT rc; - POINT p; - GetClientRect(hwnd, &rc); - p.x=rc.left; p.y=rc.top, - ClientToScreen(hwnd,&p); - rc.left=p.x;rc.top=p.y; - return screenCapturePart(rc.left,rc.top,rc.right,rc.bottom,fname,quality) ; -} -int screenCaptureWinRect( HWND hwnd, LPCSTR fname, int quality ) { - RECT r; - GetWindowRect(hwnd, &r); - return screenCapturePart(r.left,r.top,r.right-r.left,r.bottom-r.top,fname,quality) ; -} -int screenCaptureAll( LPCSTR fname, int quality ) { - return screenCapturePart(0,0,GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics (SM_CYSCREEN),fname,quality) ; -} /******************************/ @@ -769,7 +729,7 @@ static void color_opacity_gradient( HDC destDc, int x, int y, int width, int hei int OpacityMin = 0, OpacityMax = 100 ; char buf[256] = "" ; - if( GetSessionField( conf_get_str(conf,CONF_sessionname)/*cfg.sessionname*/, conf_get_str(conf,CONF_folder)/*cfg.folder*/, "BgOpacityRange", buf ) ) { + if( GetSessionField( conf_get_str(conf,CONF_sessionname), conf_get_str(conf,CONF_folder), "BgOpacityRange", buf ) ) { sscanf( buf, "%d-%d", &OpacityMin, &OpacityMax ) ; if( OpacityMin == OpacityMax ) { OpacityMin = 0 ; OpacityMax = 100 ; } } @@ -931,24 +891,19 @@ BOOL load_bg_bmp() int x, y; int style; - // TODO: If cfg.bg_image_style == 1, we should use the system wallpaper - // background color instead of this. Probably just pass this as a parameter - // to load_wallpaper_bmp so it can override this default while it's - // accessing the registry anyway. - //COLORREF backgroundcolor = colours[258]; // Default Background COLORREF backgroundcolor = return_colours258() ; COLORREF alphacolor = backgroundcolor; // Start off assuming this is true. - bBgRelToTerm = conf_get_int( conf,CONF_bg_image_abs_fixed); // cfg.bg_image_abs_fixed; + bBgRelToTerm = conf_get_int( conf,CONF_bg_image_abs_fixed); RECT clientRect; GetWindowRect( MainHwnd, &clientRect ) ; clientWidth = clientRect.right-clientRect.left+1 ; clientHeight = clientRect.bottom-clientRect.top+1 ; - switch( conf_get_int( conf,CONF_bg_type)/*cfg.bg_type*/ ) + switch( conf_get_int( conf,CONF_bg_type) ) { // Solid case 0: @@ -967,19 +922,19 @@ BOOL load_bg_bmp() case 2: { backgroundcolor = GetSysColor(COLOR_BACKGROUND) ; - if( conf_get_filename(conf,CONF_bg_image_filename)/*cfg.bg_image_filename.*/->path[0] == '#' ) { + if( conf_get_filename(conf,CONF_bg_image_filename)->path[0] == '#' ) { int r=0,g=0,b=0; - sscanf( conf_get_filename(conf,CONF_bg_image_filename)/*cfg.bg_image_filename.*/->path, "#%02X%02X%02X", &r, &g, &b ) ; + sscanf( conf_get_filename(conf,CONF_bg_image_filename)->path, "#%02X%02X%02X", &r, &g, &b ) ; backgroundcolor = RGB( r, g, b ) ; BYTE *pDst = NULL; rawImage = CreateHBitmap(10, 10, (void**)&pDst); style = 4 ; } - else if( !stricmp( conf_get_filename(conf,CONF_bg_image_filename)/*cfg.bg_image_filename.*/->path+strlen(conf_get_filename(conf,CONF_bg_image_filename)/*cfg.bg_image_filename.*/->path)-4, ".jpg" ) ) { + else if( !stricmp( conf_get_filename(conf,CONF_bg_image_filename)->path+strlen(conf_get_filename(conf,CONF_bg_image_filename)->path)-4, ".jpg" ) ) { if(!load_file_jpeg(&rawImage, &style, &x, &y)) rawImage = NULL; // Make sure rawImage is still NULL. } - else if( !stricmp( conf_get_filename(conf,CONF_bg_image_filename)/*cfg.bg_image_filename.*/->path+strlen(conf_get_filename(conf,CONF_bg_image_filename)/*cfg.bg_image_filename.*/->path)-5, ".jpeg" ) ) { + else if( !stricmp( conf_get_filename(conf,CONF_bg_image_filename)->path+strlen(conf_get_filename(conf,CONF_bg_image_filename)->path)-5, ".jpeg" ) ) { if(!load_file_jpeg(&rawImage, &style, &x, &y)) rawImage = NULL; // Make sure rawImage is still NULL. } @@ -996,7 +951,6 @@ BOOL load_bg_bmp() // Securite pour ne pas depacer les limites de l'ecran principal -//debug_log("%d %d %d %d %d %d %d\n",cfg.bg_image_abs_fixed,clientRect.left,clientRect.top,clientRect.right,clientRect.bottom,deskWidth,deskHeight ); if( (bBgRelToTerm == 0) &&((clientRect.right>deskWidth)||(clientRect.bottom>deskHeight)) ) { //DeleteObject(rawImage); rawImage = NULL ; @@ -1126,8 +1080,8 @@ BOOL load_bg_bmp() backgrounddc, 0, 0, SRCCOPY ); - if( conf_get_int(conf,CONF_bg_opacity)/*cfg.bg_opacity*/ >= 0 ) - { color_blend( backgroundblenddc, 0, 0, deskWidth, deskHeight, alphacolor, conf_get_int(conf,CONF_bg_opacity)/*cfg.bg_opacity*/); } + if( conf_get_int(conf,CONF_bg_opacity) >= 0 ) + { color_blend( backgroundblenddc, 0, 0, deskWidth, deskHeight, alphacolor, conf_get_int(conf,CONF_bg_opacity)); } else { if( bBgRelToTerm == 1 ) { @@ -1135,7 +1089,7 @@ BOOL load_bg_bmp() deskHeight = clientHeight ; } - color_opacity_gradient( backgroundblenddc, 0, 0, deskWidth, deskHeight, alphacolor, -conf_get_int(conf,CONF_bg_opacity)/*cfg.bg_opacity*/ ); + color_opacity_gradient( backgroundblenddc, 0, 0, deskWidth, deskHeight, alphacolor, -conf_get_int(conf,CONF_bg_opacity) ); } } @@ -1514,3 +1468,45 @@ HBITMAP hbm = HWND_to_HBITMAP(GetDesktopWindow()); DeleteObject(hbm); } } + +int screenCapturePart(int x, int y, int w, int h, LPCSTR fname,int quality) { + int return_code = 0 ; + HDC hdcSource = GetDC(NULL); + HDC hdcMemory = CreateCompatibleDC(hdcSource); + + //int capX = GetDeviceCaps(hdcSource, HORZRES); + //int capY = GetDeviceCaps(hdcSource, VERTRES); + + HBITMAP hBitmap = CreateCompatibleBitmap(hdcSource, w, h); + HBITMAP hBitmapOld = (HBITMAP)SelectObject(hdcMemory, hBitmap); + + BitBlt(hdcMemory, 0, 0, w, h, hdcSource, x, y, SRCCOPY); + hBitmap = (HBITMAP)SelectObject(hdcMemory, hBitmapOld); + + DeleteDC(hdcSource); + DeleteDC(hdcMemory); + + //HPALETTE hpal = NULL; + if( HBITMAP_to_JPG( hBitmap,fname, quality) ) { return_code = 1 ; } + DeleteObject(hBitmap); + + return return_code ; +} + +int screenCaptureClientRect( HWND hwnd, LPCSTR fname, int quality ) { + RECT rc; + POINT p; + GetClientRect(hwnd, &rc); + p.x=rc.left; p.y=rc.top, + ClientToScreen(hwnd,&p); + rc.left=p.x;rc.top=p.y; + return screenCapturePart(rc.left,rc.top,rc.right,rc.bottom,fname,quality) ; +} +int screenCaptureWinRect( HWND hwnd, LPCSTR fname, int quality ) { + RECT r; + GetWindowRect(hwnd, &r); + return screenCapturePart(r.left,r.top,r.right-r.left,r.bottom-r.top,fname,quality) ; +} +int screenCaptureAll( LPCSTR fname, int quality ) { + return screenCapturePart(0,0,GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics (SM_CYSCREEN),fname,quality) ; +} diff --git a/kitty_image.h b/kitty_image.h index 921feb0..9fba888 100644 --- a/kitty_image.h +++ b/kitty_image.h @@ -26,3 +26,4 @@ int screenCaptureAll( LPCSTR fname, int quality ) ; #endif void MakeScreenShot(); +int screenCaptureClientRect( HWND hwnd, LPCSTR fname, int quality ) ; diff --git a/kitty_savedump.c b/kitty_savedump.c index 2f91878..76d1b2f 100644 --- a/kitty_savedump.c +++ b/kitty_savedump.c @@ -322,7 +322,7 @@ void SaveDumpConfig( FILE *fp, Conf * conf ) { /* Keyboard options */ fprintf( fp, "bksp_is_delete=%d\n", conf_get_bool(conf,CONF_bksp_is_delete) ) ; - fprintf( fp, "rxvt_homeend=%d\n", conf_get_bool(conf,CONF_rxvt_homeend) ) ; + fprintf( fp, "rxvt_homeend=%d\n", conf_get_int(conf,CONF_rxvt_homeend) ) ; fprintf( fp, "funky_type=%d\n", conf_get_int(conf,CONF_funky_type) ) ; fprintf( fp, "no_applic_c=%d\n", conf_get_bool(conf,CONF_no_applic_c) ) ; fprintf( fp, "no_applic_k=%d\n", conf_get_bool(conf,CONF_no_applic_k) ) ; @@ -483,7 +483,7 @@ void SaveDumpConfig( FILE *fp, Conf * conf ) { fprintf( fp, "sendtotray=%d\n", conf_get_int(conf,CONF_sendtotray) ) ; fprintf( fp, "maximize=%d\n", conf_get_int(conf,CONF_maximize) ) ; fprintf( fp, "fullscreen=%d\n", conf_get_int(conf,CONF_fullscreen) ) ; - fprintf( fp, "saveonexit=%d\n", conf_get_int(conf,CONF_saveonexit) ) ; + fprintf( fp, "saveonexit=%d\n", conf_get_bool(conf,CONF_saveonexit) ) ; fprintf( fp, "icone=%d\n", conf_get_int(conf,CONF_icone) ) ; fprintf( fp, "iconefile=%s\n", conf_get_filename(conf,CONF_iconefile)->path ) ; fprintf( fp, "sftpconnect=%s\n", conf_get_str(conf,CONF_sftpconnect) ) ; diff --git a/kitty_settings.c b/kitty_settings.c index 099fcc8..0ab7673 100644 --- a/kitty_settings.c +++ b/kitty_settings.c @@ -145,7 +145,7 @@ void save_open_settings_forced(char *filename, Conf *conf) { write_setting_b_forced(sesskey, "RFCEnviron", conf_get_bool(conf, CONF_rfc_environ)); write_setting_b_forced(sesskey, "PassiveTelnet", conf_get_bool(conf, CONF_passive_telnet)); write_setting_b_forced(sesskey, "BackspaceIsDelete", conf_get_bool(conf, CONF_bksp_is_delete)); - write_setting_b_forced(sesskey, "RXVTHomeEnd", conf_get_bool(conf, CONF_rxvt_homeend)); + write_setting_i_forced(sesskey, "RXVTHomeEnd", conf_get_int(conf, CONF_rxvt_homeend)); write_setting_i_forced(sesskey, "LinuxFunctionKeys", conf_get_int(conf, CONF_funky_type)); write_setting_b_forced(sesskey, "NoApplicationKeys", conf_get_bool(conf, CONF_no_applic_k)); write_setting_b_forced(sesskey, "NoApplicationCursors", conf_get_bool(conf, CONF_no_applic_c)); @@ -390,7 +390,7 @@ void save_open_settings_forced(char *filename, Conf *conf) { write_setting_i_forced(sesskey, "SendToTray", conf_get_int(conf, CONF_sendtotray) ); write_setting_i_forced(sesskey, "Maximize", conf_get_int(conf, CONF_maximize) ); write_setting_i_forced(sesskey, "Fullscreen", conf_get_int(conf, CONF_fullscreen) ); - write_setting_i_forced(sesskey, "SaveOnExit", conf_get_int(conf, CONF_saveonexit) ); + write_setting_b_forced(sesskey, "SaveOnExit", conf_get_bool(conf, CONF_saveonexit) ); write_setting_i_forced(sesskey, "Icone", conf_get_int(conf, CONF_icone) ); write_setting_filename_forced(sesskey, "IconeFile", conf_get_filename(conf, CONF_iconefile) ); write_setting_s_forced(sesskey, "SFTPConnect", conf_get_str(conf, CONF_sftpconnect) ); @@ -686,7 +686,7 @@ void load_open_settings_forced(char *filename, Conf *conf) { gppb_forced(sesskey, "RFCEnviron", false, conf, CONF_rfc_environ); gppb_forced(sesskey, "PassiveTelnet", false, conf, CONF_passive_telnet); gppb_forced(sesskey, "BackspaceIsDelete", true, conf, CONF_bksp_is_delete); - gppb_forced(sesskey, "RXVTHomeEnd", false, conf, CONF_rxvt_homeend); + gppi_forced(sesskey, "RXVTHomeEnd", 0, conf, CONF_rxvt_homeend); gppi_forced(sesskey, "LinuxFunctionKeys", 0, conf, CONF_funky_type); gppb_forced(sesskey, "NoApplicationKeys", false, conf, CONF_no_applic_k); gppb_forced(sesskey, "NoApplicationCursors", false, conf, CONF_no_applic_c); @@ -1019,7 +1019,7 @@ void load_open_settings_forced(char *filename, Conf *conf) { gppi_forced(sesskey, "SendToTray", 0, conf, CONF_sendtotray ); gppi_forced(sesskey, "Maximize", 0, conf, CONF_maximize ); gppi_forced(sesskey, "Fullscreen", 0, conf, CONF_fullscreen ); - gppi_forced(sesskey, "SaveOnExit", 0, conf, CONF_saveonexit ); + gppb_forced(sesskey, "SaveOnExit", false, conf, CONF_saveonexit ); gppi_forced(sesskey, "Icone", 1, conf, CONF_icone ); gppfile_forced(sesskey, "IconeFile", conf, CONF_iconefile ); gpps_forced(sesskey, "SFTPConnect", "", conf, CONF_sftpconnect );