-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changing selection filter to a list of types, rather than a mask
- Loading branch information
Showing
30 changed files
with
208 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#pragma once | ||
#include <set> | ||
|
||
// To support objects from anywhere, which can be added later, I am removing GetMarkingMask for objects. | ||
// Instead, this CFilter class will use the object's GetType | ||
// if there are any types in the set, only those can be picked | ||
// else if types set is empty, any object can be picked | ||
class CFilter | ||
{ | ||
std::set<int> m_types; | ||
public: | ||
CFilter(){} | ||
void Clear(){ m_types.clear(); } | ||
void AddType(int type){ m_types.insert(type); } | ||
bool CanTypeBePicked(int type)const{ | ||
if (m_types.size() == 0)return true; | ||
return (m_types.find(type) != m_types.end()); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import wx | ||
import cad | ||
from HDialog import HDialog | ||
|
||
class FilterDlg(HDialog): | ||
def __init__(self): | ||
HDialog.__init__(self, title = 'Filter') | ||
|
||
self.names_and_types = cad.GetObjectNamesAndTypes() | ||
print(len( self.names_and_types )) | ||
self.check_boxes = [] | ||
|
||
sizerMain = wx.BoxSizer(wx.VERTICAL) | ||
for name, type in cad.GetObjectNamesAndTypes(): | ||
check_box = wx.CheckBox(self, wx.ID_ANY, name) | ||
self.check_boxes.append((check_box, type)) | ||
if wx.GetApp().select_mode.filter.CanTypeBePicked(type): | ||
check_box.SetValue(True) | ||
sizerMain.Add(check_box, 0, wx.ALL, 2) | ||
|
||
self.MakeOkAndCancel(wx.HORIZONTAL).AddToSizer(sizerMain) | ||
|
||
self.SetSizer( sizerMain ) | ||
sizerMain.SetSizeHints( self ) | ||
sizerMain.Fit( self ) | ||
|
||
def SetFilterFromCheckBoxes(self): | ||
checked_types = [] | ||
for check_box, type in self.check_boxes: | ||
if check_box.IsChecked(): | ||
checked_types.append(type) | ||
wx.GetApp().select_mode.filter.Clear() | ||
if len(checked_types) < len(self.names_and_types): | ||
for checked_type in checked_types: | ||
wx.GetApp().select_mode.filter.AddType(checked_type) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.