Author Topic: Bookmarks form, hack to enable multi-select for deleting.  (Read 1693 times)

MindprisM

  • Senior Community Member
  • Posts: 127
  • Hero Points: 8
Bookmarks form, hack to enable multi-select for deleting.
« on: July 22, 2013, 09:47:54 am »
SlickEdit 2012 (v17.0.3.0 64-bit)

The tree list in the bookmarks pane will only allow single selection. Enable multiselect by editing the form (_tbbookmarks_form), selecting the tree list and set its multi_select property to MS_SIMPLE_LIST. Save the form.

Then in bookmarks.e, disable the current code in procedure void ctl_bookmarks_tree.DEL() and replace it with:

Code: [Select]
  #if 1
  int nos;
  nos=_TreeGetNumSelectedItems();
  int x,n;
  typeless a[];
  typeless b[];
  n=_TreeGetNextSelectedIndex(1,0);
  _str bm_name ='';
  if (n!=-1) {
    bm_name= _TreeGetUserInfo(n);
    int bm_index = _BookmarkFind(bm_name);
    if (bm_index >-1){
      a[a._length()]=n;
      b[b._length()]=bm_index;
      //_BookmarkRemove(bm_index);
      //say('removed n:'(n)' name:'bm_name);
    }
  }
  int xx;
  for (x=0;x<nos-1;x++) {
    n=_TreeGetNextSelectedIndex(0,xx);
    bm_name = '';
    if (n!=-1) {
      bm_name = _TreeGetUserInfo(n);
      int bm_index = _BookmarkFind(bm_name);
      if (bm_index >-1){
        a[a._length()]=n;
        b[b._length()]=bm_index;
      }
    }
  }
  for (x=0;x<b._length();x++) {
    int bi=b[x];
    _BookmarkRemove(bi);
  }
  updateBookmarksToolWindow(0);
  #endif

For a bonus, you can make clearbookmarks (S-DEL) leave alt-bookmarks 0-9 by injecting this code in clear_bookmarks:
Code: [Select]
      if (vsbmflags & VSBMFLAG_STANDARD) {
        //m.c.r+
        if (BookmarkName=='0'||
            BookmarkName=='1'||
            BookmarkName=='2'||
            BookmarkName=='3'||
            BookmarkName=='4'||
            BookmarkName=='5'||
            BookmarkName=='6'||
            BookmarkName=='7'||
            BookmarkName=='8'||
            BookmarkName=='9'
            ) {
        }else{
          //m.c.r-
         _BookmarkRemove(i);
        }
      }
Then Reload bookmarks.e
« Last Edit: July 22, 2013, 09:58:36 am by MindprisM »