Ticket #3178: mc-3178-update-input-colors.patch

File mc-3178-update-input-colors.patch, 9.3 KB (added by egmont, 8 years ago)
  • lib/widget/input.c

    diff --git a/lib/widget/input.c b/lib/widget/input.c
    index 14d87ea..3ae9679 100644
    a b int quote = 0; 
    6060 
    6161const global_keymap_t *input_map = NULL; 
    6262 
     63/* Color styles for normal and command line input widgets */ 
     64input_colors_t input_colors; 
     65input_colors_t command_colors; 
     66 
    6367/*** file scope macro definitions ****************************************************************/ 
    6468 
    6569#define LARGE_HISTORY_BUTTON 1 
    input_set_options_callback (Widget * w, widget_options_t options, gboolean enabl 
    989993  * @return                     WInput object 
    990994  */ 
    991995WInput * 
    992 input_new (int y, int x, const int *input_colors, int width, const char *def_text, 
     996input_new (int y, int x, const int *colors, int width, const char *def_text, 
    993997           const char *histname, input_complete_t completion_flags) 
    994998{ 
    995999    WInput *in; 
    input_new (int y, int x, const int *input_colors, int width, const char *def_tex 
    10011005    w->options |= W_IS_INPUT; 
    10021006    w->set_options = input_set_options_callback; 
    10031007 
    1004     memmove (in->color, input_colors, sizeof (input_colors_t)); 
    1005  
     1008    in->color = colors; 
    10061009    in->first = TRUE; 
    10071010    in->highlight = FALSE; 
    10081011    in->term_first_shown = 0; 
    input_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d 
    11101113 
    11111114/* --------------------------------------------------------------------------------------------- */ 
    11121115 
    1113 /** Get default colors for WInput widget. 
    1114   * @return default colors 
    1115   */ 
    1116 const int * 
    1117 input_get_default_colors (void) 
     1116void 
     1117input_set_default_colors (void) 
    11181118{ 
    1119     static input_colors_t standart_colors; 
    1120  
    1121     standart_colors[WINPUTC_MAIN] = INPUT_COLOR; 
    1122     standart_colors[WINPUTC_MARK] = INPUT_MARK_COLOR; 
    1123     standart_colors[WINPUTC_UNCHANGED] = INPUT_UNCHANGED_COLOR; 
    1124     standart_colors[WINPUTC_HISTORY] = INPUT_HISTORY_COLOR; 
    1125  
    1126     return standart_colors; 
     1119    input_colors[WINPUTC_MAIN] = INPUT_COLOR; 
     1120    input_colors[WINPUTC_MARK] = INPUT_MARK_COLOR; 
     1121    input_colors[WINPUTC_UNCHANGED] = INPUT_UNCHANGED_COLOR; 
     1122    input_colors[WINPUTC_HISTORY] = INPUT_HISTORY_COLOR; 
     1123 
     1124    command_colors[WINPUTC_MAIN] = DEFAULT_COLOR; 
     1125    command_colors[WINPUTC_MARK] = COMMAND_MARK_COLOR; 
     1126    command_colors[WINPUTC_UNCHANGED] = DEFAULT_COLOR; 
     1127    command_colors[WINPUTC_HISTORY] = COMMAND_HISTORY_COLOR; 
    11271128} 
    11281129 
    11291130/* --------------------------------------------------------------------------------------------- */ 
  • lib/widget/input.h

    diff --git a/lib/widget/input.h b/lib/widget/input.h
    index 65982a5..d79bd45 100644
    a b typedef int input_colors_t[WINPUTC_COUNT_COLORS]; 
    4646typedef struct 
    4747{ 
    4848    Widget widget; 
    49     input_colors_t color; 
     49    const int *color; 
    5050    int point;                  /* cursor position in the input line in characters */ 
    5151    int mark;                   /* the mark position in characters */ 
    5252    gboolean highlight;         /* there is a selected block */ 
    extern int quote; 
    7979 
    8080extern const global_keymap_t *input_map; 
    8181 
     82/* Color styles for normal and command line input widgets */ 
     83extern input_colors_t input_colors; 
     84extern input_colors_t command_colors; 
     85 
    8286/*** declarations of public functions ************************************************************/ 
    8387 
    84 WInput *input_new (int y, int x, const int *input_colors, 
     88WInput *input_new (int y, int x, const int *colors, 
    8589                   int len, const char *text, const char *histname, 
    8690                   input_complete_t completion_flags); 
    8791/* callbac is public; needed for command line */ 
    8892cb_ret_t input_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data); 
    89 const int *input_get_default_colors (void); 
     93void input_set_default_colors (void); 
    9094cb_ret_t input_handle_char (WInput * in, int key); 
    9195int input_key_is_in_map (WInput * in, int key); 
    9296void input_assign_text (WInput * in, const char *text); 
  • lib/widget/quick.c

    diff --git a/lib/widget/quick.c b/lib/widget/quick.c
    index c4aceed..a4b4ec4 100644
    a b quick_create_input (int y, int x, const quick_widget_t * qw) 
    7070{ 
    7171    WInput *in; 
    7272 
    73     in = input_new (y, x, input_get_default_colors (), 8, qw->u.input.text, qw->u.input.histname, 
     73    in = input_new (y, x, input_colors, 8, qw->u.input.text, qw->u.input.histname, 
    7474                    qw->u.input.completion_flags); 
    7575 
    7676    in->is_password = qw->u.input.is_passwd; 
  • src/editor/editcmd_dialogs.c

    diff --git a/src/editor/editcmd_dialogs.c b/src/editor/editcmd_dialogs.c
    index c66787b..84039f2 100644
    a b editcmd_dialog_raw_key_query (const char *heading, const char *query, gboolean c 
    323323                    NULL, NULL, heading, DLG_CENTER | DLG_TRYUP | DLG_WANT_TAB); 
    324324 
    325325    add_widget (raw_dlg, label_new (y, 3, query)); 
    326     add_widget (raw_dlg, input_new (y++, 3 + wq + 1, input_get_default_colors (), 
     326    add_widget (raw_dlg, input_new (y++, 3 + wq + 1, input_colors, 
    327327                                    w - (6 + wq + 1), "", 0, INPUT_COMPLETE_NONE)); 
    328328    if (cancel) 
    329329    { 
  • src/filemanager/boxes.c

    diff --git a/src/filemanager/boxes.c b/src/filemanager/boxes.c
    index 026f5b3..042fe8b 100644
    a b skin_apply (const gchar * skin_override) 
    528528    mc_fhl_free (&mc_filehighlight); 
    529529    mc_filehighlight = mc_fhl_new (TRUE); 
    530530    dlg_set_default_colors (); 
     531    input_set_default_colors (); 
    531532    panel_deinit (); 
    532533    panel_init (); 
    533534    repaint_screen (); 
  • src/filemanager/command.c

    diff --git a/src/filemanager/command.c b/src/filemanager/command.c
    index 5b06921..7fde0a9 100644
    a b WInput * 
    463463command_new (int y, int x, int cols) 
    464464{ 
    465465    WInput *cmd; 
    466     const input_colors_t command_colors = { 
    467         DEFAULT_COLOR, 
    468         COMMAND_MARK_COLOR, 
    469         DEFAULT_COLOR, 
    470         COMMAND_HISTORY_COLOR 
    471     }; 
    472  
    473     cmd = input_new (y, x, (int *) command_colors, cols, "", "cmdline", 
     466 
     467    cmd = input_new (y, x, command_colors, cols, "", "cmdline", 
    474468                     INPUT_COMPLETE_FILENAMES | INPUT_COMPLETE_VARIABLES | INPUT_COMPLETE_USERNAMES 
    475469                     | INPUT_COMPLETE_HOSTNAMES | INPUT_COMPLETE_CD | INPUT_COMPLETE_COMMANDS | 
    476470                     INPUT_COMPLETE_SHELL_ESC); 
  • src/filemanager/find.c

    diff --git a/src/filemanager/find.c b/src/filemanager/find.c
    index 76134cf..e457ded 100644
    a b find_parameters (char **start_dir, ssize_t * start_dir_len, 
    615615 
    616616    add_widget (find_dlg, label_new (y1++, x1, _("Start at:"))); 
    617617    in_start = 
    618         input_new (y1, x1, input_get_default_colors (), cols - b0 - 7, in_start_dir, "start", 
     618        input_new (y1, x1, input_colors, cols - b0 - 7, in_start_dir, "start", 
    619619                   INPUT_COMPLETE_CD | INPUT_COMPLETE_FILENAMES); 
    620620    add_widget (find_dlg, in_start); 
    621621 
    find_parameters (char **start_dir, ssize_t * start_dir_len, 
    626626    add_widget (find_dlg, ignore_dirs_cbox); 
    627627 
    628628    in_ignore = 
    629         input_new (y1++, x1, input_get_default_colors (), cols - 6, 
     629        input_new (y1++, x1, input_colors, cols - 6, 
    630630                   options.ignore_dirs != NULL ? options.ignore_dirs : "", "ignoredirs", 
    631631                   INPUT_COMPLETE_CD | INPUT_COMPLETE_FILENAMES); 
    632632    widget_disable (WIDGET (in_ignore), !options.ignore_dirs_enable); 
    find_parameters (char **start_dir, ssize_t * start_dir_len, 
    639639    /* Start 1st column */ 
    640640    add_widget (find_dlg, label_new (y1++, x1, file_name_label)); 
    641641    in_name = 
    642         input_new (y1++, x1, input_get_default_colors (), cw, INPUT_LAST_TEXT, "name", 
     642        input_new (y1++, x1, input_colors, cw, INPUT_LAST_TEXT, "name", 
    643643                   INPUT_COMPLETE_FILENAMES | INPUT_COMPLETE_CD); 
    644644    add_widget (find_dlg, in_name); 
    645645 
    find_parameters (char **start_dir, ssize_t * start_dir_len, 
    647647    content_label = label_new (y2++, x2, content_content_label); 
    648648    add_widget (find_dlg, content_label); 
    649649    in_with = 
    650         input_new (y2++, x2, input_get_default_colors (), cw, INPUT_LAST_TEXT, 
     650        input_new (y2++, x2, input_colors, cw, INPUT_LAST_TEXT, 
    651651                   MC_HISTORY_SHARED_SEARCH, INPUT_COMPLETE_NONE); 
    652652    in_with->label = content_label; 
    653653    widget_disable (WIDGET (in_with), disable); 
  • src/filemanager/panelize.c

    diff --git a/src/filemanager/panelize.c b/src/filemanager/panelize.c
    index 7d0c360..45e2519 100644
    a b init_panelize (void) 
    186186    y += WIDGET (l_panelize)->lines + 1; 
    187187    add_widget (panelize_dlg, label_new (y++, UX, _("Command"))); 
    188188    pname = 
    189         input_new (y++, UX, input_get_default_colors (), panelize_cols - UX * 2, "", "in", 
     189        input_new (y++, UX, input_colors, panelize_cols - UX * 2, "", "in", 
    190190                   INPUT_COMPLETE_FILENAMES | INPUT_COMPLETE_HOSTNAMES | INPUT_COMPLETE_COMMANDS | 
    191191                   INPUT_COMPLETE_VARIABLES | INPUT_COMPLETE_USERNAMES | INPUT_COMPLETE_CD | 
    192192                   INPUT_COMPLETE_SHELL_ESC); 
  • src/main.c

    diff --git a/src/main.c b/src/main.c
    index dc340bb..28bddd2 100644
    a b main (int argc, char *argv[]) 
    372372 
    373373    mc_skin_init (NULL, &error); 
    374374    dlg_set_default_colors (); 
     375    input_set_default_colors (); 
    375376    if (error != NULL) 
    376377    { 
    377378        message (D_ERROR, _("Warning"), "%s", error->message);