[Bf-blender-cvs] [8aba00a6735] filebrowser_redesign: Remove dead code

Julian Eisel noreply at git.blender.org
Fri Jul 26 01:26:13 CEST 2019


Commit: 8aba00a673565eb9239ec6c9fc4af85f74a49c2a
Author: Julian Eisel
Date:   Fri Jul 26 00:05:43 2019 +0200
Branches: filebrowser_redesign
https://developer.blender.org/rB8aba00a673565eb9239ec6c9fc4af85f74a49c2a

Remove dead code

Now handled in Python.

===================================================================

M	source/blender/editors/space_file/file_draw.c

===================================================================

diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 588c9df5714..1fbdaeaf712 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -77,287 +77,6 @@ static char *file_draw_tooltip_func(bContext *UNUSED(C), void *argN, const char
   return BLI_strdup(dyn_tooltip);
 }
 
-#if 0
-/* Note: This function uses pixelspace (0, 0, winx, winy), not view2d.
- * The controls are laid out as follows:
- *
- * -------------------------------------------
- * | Directory input               | execute |
- * -------------------------------------------
- * | Filename input        | + | - | cancel  |
- * -------------------------------------------
- *
- * The input widgets will stretch to fill any excess space.
- * When there isn't enough space for all controls to be shown, they are
- * hidden in this order: x/-, execute/cancel, input widgets.
- */
-void file_draw_filepath_buttons(const bContext *C, ARegion *ar)
-{
-  /* Button layout. */
-  const int max_x = ar->winx - 10;
-  const int line1_y = ar->winy - (IMASEL_BUTTONS_HEIGHT / 2 + IMASEL_BUTTONS_MARGIN);
-  const int line2_y = line1_y - (IMASEL_BUTTONS_HEIGHT / 2 + IMASEL_BUTTONS_MARGIN);
-  const int input_minw = 20;
-  const int btn_h = UI_UNIT_Y;
-  const int btn_fn_w = UI_UNIT_X;
-  const int btn_minw = 80;
-  const int btn_margin = 20;
-  const int separator = 4;
-
-  /* Additional locals. */
-  char uiblockstr[32];
-  int loadbutton;
-  int fnumbuttons;
-  int min_x = 10;
-  int chan_offs = 0;
-  int available_w = max_x - min_x;
-  int line1_w = available_w;
-  int line2_w = available_w;
-
-  uiBut *but;
-  uiBlock *block;
-  SpaceFile *sfile = CTX_wm_space_file(C);
-  FileSelectParams *params = ED_fileselect_get_params(sfile);
-  ARegion *artmp;
-  const bool is_browse_only = (sfile->op == NULL);
-
-  /* Initialize UI block. */
-  BLI_snprintf(uiblockstr, sizeof(uiblockstr), "win %p", (void *)ar);
-  block = UI_block_begin(C, ar, uiblockstr, UI_EMBOSS);
-
-  /* exception to make space for collapsed region icon */
-  for (artmp = CTX_wm_area(C)->regionbase.first; artmp; artmp = artmp->next) {
-    if (artmp->regiontype == RGN_TYPE_TOOLS && artmp->flag & RGN_FLAG_HIDDEN) {
-      chan_offs = 16;
-      min_x += chan_offs;
-      available_w -= chan_offs;
-    }
-  }
-
-  /* Is there enough space for the execute / cancel buttons? */
-
-  if (is_browse_only) {
-    loadbutton = 0;
-  }
-  else {
-    const uiFontStyle *fstyle = UI_FSTYLE_WIDGET;
-    loadbutton = UI_fontstyle_string_width(fstyle, params->title) + btn_margin;
-    CLAMP_MIN(loadbutton, btn_minw);
-    if (available_w <= loadbutton + separator + input_minw) {
-      loadbutton = 0;
-    }
-  }
-
-  if (loadbutton) {
-    line1_w -= (loadbutton + separator);
-    line2_w = line1_w;
-  }
-
-  /* Is there enough space for file number increment/decrement buttons? */
-  fnumbuttons = 2 * btn_fn_w;
-  if (!loadbutton || line2_w <= fnumbuttons + separator + input_minw) {
-    fnumbuttons = 0;
-  }
-  else {
-    line2_w -= (fnumbuttons + separator);
-  }
-
-  /* Text input fields for directory and file. */
-  if (available_w > 0) {
-    const struct FileDirEntry *file = sfile->files ?
-                                          filelist_file(sfile->files, params->active_file) :
-                                          NULL;
-    int overwrite_alert = file_draw_check_exists(sfile);
-    const bool is_active_dir = file && (file->typeflag & FILE_TYPE_FOLDER);
-
-    /* callbacks for operator check functions */
-    UI_block_func_set(block, file_draw_check_cb, NULL, NULL);
-
-    but = uiDefBut(block,
-                   UI_BTYPE_TEXT,
-                   -1,
-                   "",
-                   min_x,
-                   line1_y,
-                   line1_w - chan_offs,
-                   btn_h,
-                   params->dir,
-                   0.0,
-                   (float)FILE_MAX,
-                   0,
-                   0,
-                   TIP_("File path"));
-    UI_but_func_complete_set(but, autocomplete_directory, NULL);
-    UI_but_flag_enable(but, UI_BUT_NO_UTF8);
-    UI_but_flag_disable(but, UI_BUT_UNDO);
-    UI_but_funcN_set(but, file_directory_enter_handle, NULL, but);
-
-    /* TODO, directory editing is non-functional while a library is loaded
-     * until this is properly supported just disable it. */
-    if (sfile->files && filelist_lib(sfile->files)) {
-      UI_but_flag_enable(but, UI_BUT_DISABLED);
-    }
-
-    /* clear func */
-    UI_block_func_set(block, NULL, NULL, NULL);
-  }
-
-  UI_block_end(C, block);
-  UI_block_draw(C, block);
-}
-
-void file_draw_execute_buttons(const bContext *C, ARegion *ar)
-{
-  /* Button layout. */
-  const int max_x = ar->winx - 10;
-  const int line_y = ar->winy - (IMASEL_BUTTONS_HEIGHT / 2 + IMASEL_BUTTONS_MARGIN);
-  const int input_minw = 20;
-  const int btn_h = UI_UNIT_Y;
-  const int btn_fn_w = UI_UNIT_X;
-  const int btn_minw = 80;
-  const int btn_margin = 20;
-  const int separator = 4;
-
-  SpaceFile *sfile = CTX_wm_space_file(C);
-  FileSelectParams *params = ED_fileselect_get_params(sfile);
-  const bool is_browse_only = (sfile->op == NULL);
-
-  char uiblockstr[32];
-  int loadbutton;
-  int min_x = 10;
-  int available_w = max_x - min_x;
-  int line1_w = available_w;
-  int line2_w = available_w;
-
-  uiBlock *block;
-  uiBut *but;
-
-  /* Initialize UI block. */
-  BLI_snprintf(uiblockstr, sizeof(uiblockstr), "win %p", (void *)ar);
-  block = UI_block_begin(C, ar, uiblockstr, UI_EMBOSS);
-
-  if (is_browse_only) {
-    loadbutton = 0;
-  }
-  else {
-    const uiFontStyle *fstyle = UI_FSTYLE_WIDGET;
-    loadbutton = UI_fontstyle_string_width(fstyle, params->title) + btn_margin;
-    CLAMP_MIN(loadbutton, btn_minw);
-    if (available_w <= loadbutton + separator + input_minw) {
-      loadbutton = 0;
-    }
-  }
-
-  const struct FileDirEntry *file = sfile->files ? filelist_file(sfile->files, params->active_file) : NULL;
-  int overwrite_alert = file_draw_check_exists(sfile);
-  const bool is_active_dir = file && (file->typeflag & FILE_TYPE_FOLDER);
-
-  if ((params->flag & FILE_DIRSEL_ONLY) == 0) {
-    but = uiDefBut(block,
-                   UI_BTYPE_TEXT,
-                   -1,
-                   "",
-                   min_x,
-                   line_y,
-                   line2_w,
-                   btn_h,
-                   is_active_dir ? (char *)"" : params->file,
-                   0.0,
-                   (float)FILE_MAXFILE,
-                   0,
-                   0,
-                   TIP_(overwrite_alert ? N_("File name, overwrite existing") : N_("File name")));
-    UI_but_func_complete_set(but, autocomplete_file, NULL);
-    UI_but_flag_enable(but, UI_BUT_NO_UTF8);
-    UI_but_flag_disable(but, UI_BUT_UNDO);
-    /* silly workaround calling NFunc to ensure this does not get called
-     * immediate ui_apply_but_func but only after button deactivates */
-    UI_but_funcN_set(but, file_filename_enter_handle, NULL, but);
-
-    /* check if this overrides a file and if the operator option is used */
-    if (overwrite_alert) {
-      UI_but_flag_enable(but, UI_BUT_REDALERT);
-    }
-  }
-
-#  if 0
-  /* Filename number increment / decrement buttons. */
-  if (fnumbuttons && (params->flag & FILE_DIRSEL_ONLY) == 0) {
-    UI_block_align_begin(block);
-    but = uiDefIconButO(block,
-                        UI_BTYPE_BUT,
-                        "FILE_OT_filenum",
-                        0,
-                        ICON_REMOVE,
-                        min_x + line2_w + separator - chan_offs,
-                        line2_y,
-                        btn_fn_w,
-                        btn_h,
-                        TIP_("Decrement the filename number"));
-    RNA_int_set(UI_but_operator_ptr_get(but), "increment", -1);
-
-    but = uiDefIconButO(block,
-                        UI_BTYPE_BUT,
-                        "FILE_OT_filenum",
-                        0,
-                        ICON_ADD,
-                        min_x + line2_w + separator + btn_fn_w - chan_offs,
-                        line2_y,
-                        btn_fn_w,
-                        btn_h,
-                        TIP_("Increment the filename number"));
-    RNA_int_set(UI_but_operator_ptr_get(but), "increment", 1);
-    UI_block_align_end(block);
-  }
-#  endif
-
-  /* Execute / cancel buttons. */
-  if (loadbutton) {
-    const struct FileDirEntry *file = sfile->files ?
-                                          filelist_file(sfile->files, params->active_file) :
-                                          NULL;
-    char const *str_exec;
-
-    if (file && FILENAME_IS_PARENT(file->relpath)) {
-      str_exec = IFACE_("Parent Directory");
-    }
-    else if (file && file->typeflag & FILE_TYPE_DIR) {
-      str_exec = IFACE_("Open Directory");
-    }
-    else {
-      str_exec = params->title; /* params->title is already translated! */
-    }
-
-    but = uiDefButO(block,
-                    UI_BTYPE_BUT,
-                    "FILE_OT_execute",
-                    WM_OP_EXEC_REGION_WIN,
-                    str_exec,
-                    max_x - loadbutton,
-                    line_y,
-                    loadbutton,
-                    btn_h,
-                    "");
-    /* Just a display hint. */
-    UI_but_flag_enable(but, UI_BUT_ACTIVE_DEFAULT);
-
-    uiDefButO(block,
-              UI_BTYPE_BUT,
-              "FILE_OT_cancel",
-              WM_OP_EXEC_REGION_WIN,
-              IFACE_("Cancel"),
-              max_x - loadbutton,
-              line_y,
-              loadbutton,
-              btn_h,
-              "");
-  }
-
-  UI_block_end(C, block);
-  UI_block_draw(C, block);
-}
-#endif
-
 static void draw_tile(int sx, int sy, int width, int height, int colorid, int shade)
 {
   float color[4];



More information about the Bf-blender-cvs mailing list