DFileBrowser Update #856

Merged
merged 1 commit into from Jul 28, 2015

Projects

None yet

5 participants

@TheFreeman193
Contributor

This updates and improves the DFileBrowser VGUI element.

Changes

  • Now uses DHorizontalDivider allowing tree & list to be resized
  • Fix file tree not displaying subdirectories
  • Change variable identifiers to match GMod standards
  • Now allows wildcard string (SetSearch) for refining directory tree
  • Current directory view can now be set/got
  • Following setup vars can be changed after first load:
    • SetModels
    • SetCurrentFolder
    • SetBaseFolder
    • SetSearch
    • SetPath
    • SetName
    • SetFileTypes
  • Now uses DListView for displaying normal files, replaces buttons
  • OnSelect now reports correct file path instead of base directory
  • Base directory node is now accessible (GetFolderNode)
  • Fixed a significant spelling error in DHorizontalDivider.
  • Added SortFiles(desc) method
  • File header is visible again- list can be sorted
  • Now displays current directory in file header
  • Now allows multiple file types
  • Now enforces accessor function types
  • Added SetOpen/GetOpen methods
    • Added cookie methods to handle default open/close for base node
  • Added overridable method OnDoubleClick
  • Added overridable method OnRightClick
  • Added Clear to override method inherited from panel
  • Modified background for spawnicons so highlight is visible

Tree/File list width, min and divider width can be handled with .Divider member. This avoids adding lots of accessor funcs unnecessarily:

Function Description
self.Divider:[Set/Get]LeftWidth(w) Tree width
self.Divider:[Set/Get]LeftMin(w) Minimum tree width
self.Divider:[Set/Get]RightMin(w) Minimum files width
self.Divider:[Set/Get]DividerWidth(w) Divider width

To do

  • Iterate through m_strFilter to allow multiple file types in filter
  • Add vars:
    • Open base node by default
    • Min/max width for tree/file list
    • Width of tree/file list
    • Divider width (?)
  • Enforce strings in accessor funcs
  • Different action on double click (?)
@Kefta
Contributor
Kefta commented Jan 22, 2015

I didn't know todo lists existed in markdown before this, that's cool

@TheFreeman193
Contributor

Yeah, only in GitHub's own brand of markdown though, unfortunately. There's a list of all the extra stuff they've added a little way down this page.

@TheFreeman193
Contributor

Preview for changes:
Example 1
Example 2

@TheFreeman193
Contributor

@robotboy655 Do you think this should reset the file list (on the right) when the base directory is updated or the game path is changed?

@robotboy655
Collaborator

I have no idea what you are talking about.

@willox
Collaborator
willox commented Jan 24, 2015

I think it should

@TheFreeman193
Contributor

At present, if you change the directory from which the tree is generated, the current folder being displayed on the right does not change. This would allow a user to view a directory that doesn't exist on the tree. This isn't a problem since the tree does not follow the current folder, so it's a matter of preference.

@robotboy655
Collaborator

I think it should

@TheFreeman193
Contributor

Okay then, I'll make the changes and push it later. Cheers

@TheFreeman193
Contributor

(Squashed commits)

@Kefta
Contributor
Kefta commented Jan 27, 2015

How do you squash commits?

@TheFreeman193
Contributor

The clean way to do it involves resetting the HEAD to match the master, and then staging all the changes in your local repo again. The way I use is only a good idea if noone else has pulled down or forked your repo, as it rewrites history. You run git rebase -i HEAD~xx where xx is the number of parent commits you want to mess with. It'll bring up a text file with the number of commits you specified. You can then change the keywords on each line from pick to squash or fixup, as well as reorder them. It's risky though, so make sure you check it before you push it. You'll need to run git push -f, otherwise GitHub won't let you modify the history.

You should use the first method unless you need to reorder or delete commits.

@TheFreeman193 TheFreeman193 Updates and improves DFileBrowser
Also fixes spelling in DHorizontalDivider (Rigth -> Right)
9c8cf5a
@bmwalters
Contributor

👍+1

@robotboy655 robotboy655 merged commit 9a314f9 into garrynewman:master Jul 28, 2015
@TheFreeman193 TheFreeman193 deleted the TheFreeman193:dfilebrowser branch Jul 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment