diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-21 17:18:34 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-21 23:30:04 +0300 |
commit | 0ac990d088d553c27f5360f62e142e99f087890a (patch) | |
tree | ef3637e9f8086bc937b56777ea9b1f36f97790a4 /source/blender/editors/space_file | |
parent | f8b2268f4fbe92a1860c525f70fdc293304575ff (diff) |
Cleanup: comments (long lines) in editors
Diffstat (limited to 'source/blender/editors/space_file')
-rw-r--r-- | source/blender/editors/space_file/file_draw.c | 3 | ||||
-rw-r--r-- | source/blender/editors/space_file/file_ops.c | 23 | ||||
-rw-r--r-- | source/blender/editors/space_file/filelist.c | 68 | ||||
-rw-r--r-- | source/blender/editors/space_file/filesel.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_file/fsmenu.c | 13 |
5 files changed, 72 insertions, 39 deletions
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 87560436d52..3245cbf2a29 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -689,7 +689,8 @@ void file_draw_list(const bContext *C, ARegion *ar) filelist_cache_previews_update(files); - /* Handle preview timer here, since it's filelist_file_cache_block() and filelist_cache_previews_update() + /* Handle preview timer here, + * since it's filelist_file_cache_block() and filelist_cache_previews_update() * which controls previews task. */ { const bool previews_running = filelist_cache_previews_running(files); diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 073b6d0f487..2f1671aefa7 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -1639,7 +1639,8 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), const w numfiles = filelist_files_ensure(sfile->files); /* Due to async nature of file listing, we may execute this code before `file_refresh()` - * editing entry is available in our listing, so we also have to handle switching to rename mode here. */ + * editing entry is available in our listing, + * so we also have to handle switching to rename mode here. */ FileSelectParams *params = ED_fileselect_get_params(sfile); if ((params->rename_flag & (FILE_PARAMS_RENAME_PENDING | FILE_PARAMS_RENAME_POSTSCROLL_PENDING)) != 0) { @@ -1657,8 +1658,8 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), const w /* if we are not editing, we are done */ if (edit_idx == -1) { - /* Do not invalidate timer if filerename is still pending, we might still be building the filelist - * and yet have to find edited entry... */ + /* Do not invalidate timer if filerename is still pending, + * we might still be building the filelist and yet have to find edited entry. */ if (params->rename_flag == 0) { WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), sfile->smoothscroll_timer); sfile->smoothscroll_timer = NULL; @@ -1693,8 +1694,8 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), const w } numfiles_layout = ED_fileselect_layout_numfiles(sfile->layout, ar); - /* Using margins helps avoiding scrolling to stop when target item is barely visible on one side of the screen - * (i.e. it centers a bit more the target). */ + /* Using margins helps avoiding scrolling to stop when target item + * is barely visible on one side of the screen (i.e. it centers a bit more the target). */ int numfiles_layout_margin = max_ii(0, numfiles_layout / 3); /* check if we have reached our final scroll position */ @@ -1702,7 +1703,8 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), const w (sfile->scroll_offset < offset + numfiles_layout - numfiles_layout_margin)) { WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), sfile->smoothscroll_timer); sfile->smoothscroll_timer = NULL; - /* Postscroll (after rename has been validated by user) is done, rename process is totally finisehd, cleanup. */ + /* Postscroll (after rename has been validated by user) is done, + * rename process is totally finisehd, cleanup. */ if ((params->rename_flag & FILE_PARAMS_RENAME_POSTSCROLL_ACTIVE) != 0) { params->renamefile[0] = '\0'; params->rename_flag = 0; @@ -1791,8 +1793,10 @@ void FILE_OT_filepath_drop(wmOperatorType *ot) RNA_def_string_file_path(ot->srna, "filepath", "Path", FILE_MAX, "", ""); } -/* create a new, non-existing folder name, returns 1 if successful, 0 if name couldn't be created. - * The actual name is returned in 'name', 'folder' contains the complete path, including the new folder name. +/** + * Create a new, non-existing folder name, returns 1 if successful, 0 if name couldn't be created. + * The actual name is returned in 'name', 'folder' contains the complete path, + * including the new folder name. */ static int new_folder_path(const char *parent, char *folder, char *name) { @@ -2270,7 +2274,8 @@ static int file_rename_exec(bContext *C, wmOperator *UNUSED(op)) filelist_entry_select_index_set( sfile->files, idx, FILE_SEL_ADD, FILE_SEL_EDITING, CHECK_ALL); BLI_strncpy(sfile->params->renamefile, file->relpath, FILE_MAXFILE); - /* We can skip the pending state, as we can directly set FILE_SEL_EDITING on the expected entry here. */ + /* We can skip the pending state, + * as we can directly set FILE_SEL_EDITING on the expected entry here. */ sfile->params->rename_flag = FILE_PARAMS_RENAME_ACTIVE; } ED_area_tag_redraw(sa); diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 3c3656c97c0..a6a9f3681fd 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -293,9 +293,11 @@ typedef struct FileList { struct FileListEntryCache filelist_cache; - /* We need to keep those info outside of actual filelist items, because those are no more persistent + /* We need to keep those info outside of actual filelist items, + * because those are no more persistent * (only generated on demand, and freed as soon as possible). - * Persistent part (mere list of paths + stat info) is kept as small as possible, and filebrowser-agnostic. + * Persistent part (mere list of paths + stat info) + * is kept as small as possible, and filebrowser-agnostic. */ GHash *selection_state; @@ -304,7 +306,8 @@ typedef struct FileList { struct BlendHandle *libfiledata; - /* Set given path as root directory, if last bool is true may change given string in place to a valid value. + /* Set given path as root directory, + * if last bool is true may change given string in place to a valid value. * Returns True if valid dir. */ bool (*checkdirf)(struct FileList *, char *, const bool); @@ -1177,8 +1180,8 @@ static void filelist_cache_preview_freef(TaskPool *__restrict UNUSED(pool), { FileListEntryPreview *preview = taskdata; - /* If preview->flag is empty, it means that preview has already been generated and added to done queue, - * we do not own it anymore. */ + /* If preview->flag is empty, it means that preview has already been generated and + * added to done queue, we do not own it anymore. */ if (preview->flags) { if (preview->img) { IMB_freeImBuf(preview->img); @@ -1207,7 +1210,7 @@ static void filelist_cache_previews_clear(FileListEntryCache *cache) BLI_task_pool_cancel(cache->previews_pool); while ((preview = BLI_thread_queue_pop_timeout(cache->previews_done, 0))) { - // printf("%s: DONE %d - %s - %p\n", __func__, preview->index, preview->path, preview->img); + // printf("%s: DONE %d - %s - %p\n", __func__, preview->index, preview->path, preview->img); if (preview->img) { IMB_freeImBuf(preview->img); } @@ -1514,8 +1517,10 @@ bool filelist_pending(struct FileList *filelist) } /** - * Limited version of full update done by space_file's file_refresh(), to be used by operators and such. - * Ensures given filelist is ready to be used (i.e. it is filtered and sorted), unless it is tagged for a full refresh. + * Limited version of full update done by space_file's file_refresh(), + * to be used by operators and such. + * Ensures given filelist is ready to be used (i.e. it is filtered and sorted), + * unless it is tagged for a full refresh. */ int filelist_files_ensure(FileList *filelist) { @@ -1717,7 +1722,11 @@ static void filelist_file_cache_block_release(struct FileList *filelist, for (i = 0; i < size; i++, cursor++) { FileDirEntry *entry = cache->block_entries[cursor]; - // printf("%s: release cacheidx %d (%%p %%s)\n", __func__, cursor/*, cache->block_entries[cursor], cache->block_entries[cursor]->relpath*/); +#if 0 + printf("%s: release cacheidx %d (%%p %%s)\n", + __func__, + cursor /*, cache->block_entries[cursor], cache->block_entries[cursor]->relpath*/); +#endif BLI_ghash_remove(cache->uuids, entry->uuid, NULL, NULL); filelist_file_release_entry(filelist, entry); #ifndef NDEBUG @@ -1828,8 +1837,12 @@ bool filelist_file_cache_block(struct FileList *filelist, const int index) int size2 = 0; int idx1, idx2 = 0; - // printf("\tcache releasing: [%d:%d] (%d)\n", - // cache->block_end_index - size1, cache->block_end_index, cache->block_cursor); +#if 0 + printf("\tcache releasing: [%d:%d] (%d)\n", + cache->block_end_index - size1, + cache->block_end_index, + cache->block_cursor); +#endif idx1 = (cache->block_cursor + end_index - cache->block_start_index) % cache_size; if (idx1 + size1 > cache_size) { @@ -1988,8 +2001,8 @@ bool filelist_cache_previews_update(FileList *filelist) // printf("%s: %d - %s - %p\n", __func__, preview->index, preview->path, preview->img); if (preview->img) { - /* Due to asynchronous process, a preview for a given image may be generated several times, i.e. - * entry->image may already be set at this point. */ + /* Due to asynchronous process, a preview for a given image may be generated several times, + * i.e. entry->image may already be set at this point. */ if (entry && !entry->image) { entry->image = preview->img; changed = true; @@ -2275,7 +2288,8 @@ static unsigned int groupname_to_filter_id(const char *group) } /** - * From here, we are in 'Job Context', i.e. have to be careful about sharing stuff between background working thread + * From here, we are in 'Job Context', + * i.e. have to be careful about sharing stuff between background working thread. * and main one (used by UI among other things). */ typedef struct TodoDir { @@ -2519,10 +2533,14 @@ static void filelist_readjob_main_rec(Main *bmain, FileList *filelist) # if 0 /* XXX TODO show the selection status of the objects */ if (!filelist->has_func) { /* F4 DATA BROWSE */ if (idcode == ID_OB) { - if ( ((Object *)id)->flag & SELECT) files->entry->selflag |= FILE_SEL_SELECTED; + if ( ((Object *)id)->flag & SELECT) { + files->entry->selflag |= FILE_SEL_SELECTED; + } } else if (idcode == ID_SCE) { - if ( ((Scene *)id)->r.scemode & R_BG_RENDER) files->entry->selflag |= FILE_SEL_SELECTED; + if ( ((Scene *)id)->r.scemode & R_BG_RENDER) { + files->entry->selflag |= FILE_SEL_SELECTED; + } } } # endif @@ -2533,10 +2551,20 @@ static void filelist_readjob_main_rec(Main *bmain, FileList *filelist) idcode == ID_IM) { files->typeflag |= FILE_TYPE_IMAGE; } - // if (id->lib && fake) BLI_snprintf(files->extra, sizeof(files->entry->extra), "LF %d", id->us); - // else if (id->lib) BLI_snprintf(files->extra, sizeof(files->entry->extra), "L %d", id->us); - // else if (fake) BLI_snprintf(files->extra, sizeof(files->entry->extra), "F %d", id->us); - // else BLI_snprintf(files->extra, sizeof(files->entry->extra), " %d", id->us); +# if 0 + if (id->lib && fake) { + BLI_snprintf(files->extra, sizeof(files->entry->extra), "LF %d", id->us); + } + else if (id->lib) { + BLI_snprintf(files->extra, sizeof(files->entry->extra), "L %d", id->us); + } + else if (fake) { + BLI_snprintf(files->extra, sizeof(files->entry->extra), "F %d", id->us); + } + else { + BLI_snprintf(files->extra, sizeof(files->entry->extra), " %d", id->us); + } +# endif if (id->lib) { if (totlib == 0) diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 24689d52110..9261c954bb6 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -757,8 +757,8 @@ void ED_fileselect_exit(wmWindowManager *wm, ScrArea *sa, SpaceFile *sfile) } } -/** Helper used by both main update code, and smoothscroll timer, to try to enable rename editing from - * params->renamefile name. */ +/** Helper used by both main update code, and smoothscroll timer, + * to try to enable rename editing from #FileSelectParams.renamefile name. */ void file_params_renamefile_activate(SpaceFile *sfile, FileSelectParams *params) { BLI_assert(params->rename_flag != 0); diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c index a896968dadf..f1030a93dc2 100644 --- a/source/blender/editors/space_file/fsmenu.c +++ b/source/blender/editors/space_file/fsmenu.c @@ -219,9 +219,8 @@ void fsmenu_entry_refresh_valid(struct FSMenuEntry *fsentry) if (fsentry->path && fsentry->path[0]) { #ifdef WIN32 /* XXX Special case, always consider those as valid. - * Thanks to Windows, which can spend five seconds to perform a mere stat() call on those paths... - * See T43684. - */ + * Thanks to Windows, which can spend five seconds to perform a mere stat() call on those paths + * See T43684. */ const char *exceptions[] = {"A:\\", "B:\\", NULL}; const size_t exceptions_len[] = {strlen(exceptions[0]), strlen(exceptions[1]), 0}; int i; @@ -519,11 +518,11 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks) #else # ifdef __APPLE__ { - /* Get mounted volumes better method OSX 10.6 and higher, see: */ - /*https://developer.apple.com/library/mac/#documentation/CoreFOundation/Reference/CFURLRef/Reference/reference.html*/ + /* Get mounted volumes better method OSX 10.6 and higher, see: + * https://developer.apple.com/library/mac/#documentation/CoreFOundation/Reference/CFURLRef/Reference/reference.html */ - /* we get all volumes sorted including network and do not relay - * on user-defined finder visibility, less confusing */ + /* We get all volumes sorted including network and do not relay + * on user-defined finder visibility, less confusing. */ CFURLRef cfURL = NULL; CFURLEnumeratorResult result = kCFURLEnumeratorSuccess; |