mirror of
https://github.com/cookiengineer/audacity
synced 2026-01-19 15:06:07 +01:00
Extended import filtering fixes
* Fix PluginList item selection movement (Linux) Removed some unneeded code that b0rked item selection in PluginList on Linux. * Fix RuleTable multi-item drag selection. Used undocumented EnableDragCell() method for that, but now it is not possible to select multiple items by dragging. It is still necessary to select an item before you can drag it (because click-event occurs after selection is changed and you can not select an item without moving it otherwise). * Fix indentation Converted tabs to 3-spaces. Wrapped everything at 80th column.
This commit is contained in:
@@ -55,7 +55,8 @@ BEGIN_EVENT_TABLE(ExtImportPrefs, PrefsPanel)
|
|||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
ExtImportPrefs::ExtImportPrefs(wxWindow * parent)
|
ExtImportPrefs::ExtImportPrefs(wxWindow * parent)
|
||||||
: PrefsPanel(parent, _("Extended Import")), RuleTable(NULL), PluginList(NULL), mCreateTable (false), last_selected (-1)
|
: PrefsPanel(parent, _("Extended Import")), RuleTable(NULL),
|
||||||
|
PluginList(NULL), mCreateTable (false), last_selected (-1)
|
||||||
{
|
{
|
||||||
dragtext = new wxTextDataObject(wxT(""));
|
dragtext = new wxTextDataObject(wxT(""));
|
||||||
dragtarget = new RuleTableDropTarget(dragtext);
|
dragtarget = new RuleTableDropTarget(dragtext);
|
||||||
@@ -83,7 +84,9 @@ void ExtImportPrefs::PopulateOrExchange(ShuttleGui & S)
|
|||||||
{
|
{
|
||||||
S.SetBorder(2);
|
S.SetBorder(2);
|
||||||
|
|
||||||
S.TieCheckBox(_("Filter chosen in OpenFile dialog overrides any rules"), wxT("/ExtendedImport/OverrideExtendedImportByOpenFileDialogChoice"), false);
|
S.TieCheckBox(_("Filter chosen in OpenFile dialog overrides any rules"),
|
||||||
|
wxT("/ExtendedImport/OverrideExtendedImportByOpenFileDialogChoice"),
|
||||||
|
false);
|
||||||
S.StartStatic(_("Rules to choose import filters"), 1);
|
S.StartStatic(_("Rules to choose import filters"), 1);
|
||||||
{
|
{
|
||||||
S.SetSizerProportion(1);
|
S.SetSizerProportion(1);
|
||||||
@@ -112,6 +115,7 @@ void ExtImportPrefs::PopulateOrExchange(ShuttleGui & S)
|
|||||||
RuleTable->AutoSizeColumns ();
|
RuleTable->AutoSizeColumns ();
|
||||||
|
|
||||||
RuleTable->SetDropTarget (dragtarget);
|
RuleTable->SetDropTarget (dragtarget);
|
||||||
|
RuleTable->EnableDragCell (true);
|
||||||
fillRuleTable = true;
|
fillRuleTable = true;
|
||||||
}
|
}
|
||||||
S.AddWindow(RuleTable, wxEXPAND | wxALL);
|
S.AddWindow(RuleTable, wxEXPAND | wxALL);
|
||||||
@@ -137,9 +141,12 @@ void ExtImportPrefs::PopulateOrExchange(ShuttleGui & S)
|
|||||||
S.StartHorizontalLay (wxSHRINK, 0);
|
S.StartHorizontalLay (wxSHRINK, 0);
|
||||||
{
|
{
|
||||||
MoveRuleUp = S.Id (EIPMoveRuleUp).AddButton (_("Move rule &up"));
|
MoveRuleUp = S.Id (EIPMoveRuleUp).AddButton (_("Move rule &up"));
|
||||||
MoveRuleDown = S.Id (EIPMoveRuleDown).AddButton (_("Move rule &down"));
|
MoveRuleDown = S.Id (EIPMoveRuleDown).AddButton
|
||||||
MoveFilterUp = S.Id (EIPMoveFilterUp).AddButton (_("Move f&ilter up"));
|
(_("Move rule &down"));
|
||||||
MoveFilterDown = S.Id (EIPMoveFilterDown).AddButton (_("Move &filter down"));
|
MoveFilterUp = S.Id (EIPMoveFilterUp).AddButton
|
||||||
|
(_("Move f&ilter up"));
|
||||||
|
MoveFilterDown = S.Id (EIPMoveFilterDown).AddButton
|
||||||
|
(_("Move &filter down"));
|
||||||
}
|
}
|
||||||
S.EndHorizontalLay();
|
S.EndHorizontalLay();
|
||||||
S.StartHorizontalLay (wxSHRINK, 0);
|
S.StartHorizontalLay (wxSHRINK, 0);
|
||||||
@@ -210,11 +217,13 @@ bool ExtImportPrefs::DoOnPluginKeyDown (int code)
|
|||||||
t = PluginList->GetItemText (itemIndex);
|
t = PluginList->GetItemText (itemIndex);
|
||||||
d = PluginList->GetItemData (itemIndex);
|
d = PluginList->GetItemData (itemIndex);
|
||||||
d2 = PluginList->GetItemData (itemIndex - 1);
|
d2 = PluginList->GetItemData (itemIndex - 1);
|
||||||
PluginList->SetItemText (itemIndex, PluginList->GetItemText (itemIndex - 1));
|
PluginList->SetItemText (itemIndex, PluginList->GetItemText (
|
||||||
|
itemIndex - 1));
|
||||||
PluginList->SetItemText (itemIndex - 1, t);
|
PluginList->SetItemText (itemIndex - 1, t);
|
||||||
if (d == -1 || d2 == -1)
|
if (d == -1 || d2 == -1)
|
||||||
{
|
{
|
||||||
PluginList->SetItemData (itemIndex, PluginList->GetItemData (itemIndex - 1));
|
PluginList->SetItemData (itemIndex, PluginList->GetItemData (
|
||||||
|
itemIndex - 1));
|
||||||
PluginList->SetItemData (itemIndex - 1, d);
|
PluginList->SetItemData (itemIndex - 1, d);
|
||||||
if (d == -1)
|
if (d == -1)
|
||||||
{
|
{
|
||||||
@@ -236,19 +245,19 @@ bool ExtImportPrefs::DoOnPluginKeyDown (int code)
|
|||||||
item->filters[d] = t2;
|
item->filters[d] = t2;
|
||||||
item->filters[d2] = t;
|
item->filters[d2] = t;
|
||||||
}
|
}
|
||||||
PluginList->SetItemState (itemIndex - 1, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
|
|
||||||
PluginList->SetItemState (itemIndex, 0, wxLIST_STATE_SELECTED);
|
|
||||||
}
|
}
|
||||||
else if (code == WXK_DOWN)
|
else if (code == WXK_DOWN)
|
||||||
{
|
{
|
||||||
t = PluginList->GetItemText (itemIndex);
|
t = PluginList->GetItemText (itemIndex);
|
||||||
d = PluginList->GetItemData (itemIndex);
|
d = PluginList->GetItemData (itemIndex);
|
||||||
d2 = PluginList->GetItemData (itemIndex + 1);
|
d2 = PluginList->GetItemData (itemIndex + 1);
|
||||||
PluginList->SetItemText (itemIndex, PluginList->GetItemText (itemIndex + 1));
|
PluginList->SetItemText (itemIndex, PluginList->GetItemText (
|
||||||
|
itemIndex + 1));
|
||||||
PluginList->SetItemText (itemIndex + 1, t);
|
PluginList->SetItemText (itemIndex + 1, t);
|
||||||
if (d == -1 || d2 == -1)
|
if (d == -1 || d2 == -1)
|
||||||
{
|
{
|
||||||
PluginList->SetItemData (itemIndex, PluginList->GetItemData (itemIndex + 1));
|
PluginList->SetItemData (itemIndex, PluginList->GetItemData (
|
||||||
|
itemIndex + 1));
|
||||||
PluginList->SetItemData (itemIndex + 1, d);
|
PluginList->SetItemData (itemIndex + 1, d);
|
||||||
if (d == -1)
|
if (d == -1)
|
||||||
{
|
{
|
||||||
@@ -270,8 +279,6 @@ bool ExtImportPrefs::DoOnPluginKeyDown (int code)
|
|||||||
item->filters[d] = t2;
|
item->filters[d] = t2;
|
||||||
item->filters[d2] = t;
|
item->filters[d2] = t;
|
||||||
}
|
}
|
||||||
PluginList->SetItemState (itemIndex + 1, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
|
|
||||||
PluginList->SetItemState (itemIndex, 0, wxLIST_STATE_SELECTED);
|
|
||||||
}
|
}
|
||||||
int fcount = item->filter_objects.Count();
|
int fcount = item->filter_objects.Count();
|
||||||
if (item->divider >= fcount)
|
if (item->divider >= fcount)
|
||||||
@@ -313,7 +320,8 @@ void ExtImportPrefs::SwapRows (int row1, int row2)
|
|||||||
void ExtImportPrefs::OnRuleTableKeyDown(wxKeyEvent& event)
|
void ExtImportPrefs::OnRuleTableKeyDown(wxKeyEvent& event)
|
||||||
{
|
{
|
||||||
int mods = event.GetModifiers();
|
int mods = event.GetModifiers();
|
||||||
if (mods & wxMOD_CMD && (event.GetKeyCode() == WXK_UP || event.GetKeyCode() == WXK_DOWN))
|
if (mods & wxMOD_CMD && (event.GetKeyCode() == WXK_UP ||
|
||||||
|
event.GetKeyCode() == WXK_DOWN))
|
||||||
{
|
{
|
||||||
DoOnRuleTableKeyDown (event.GetKeyCode());
|
DoOnRuleTableKeyDown (event.GetKeyCode());
|
||||||
}
|
}
|
||||||
@@ -385,7 +393,8 @@ void ExtImportPrefs::DoOnRuleTableSelect (int toprow)
|
|||||||
}
|
}
|
||||||
if (item->filter_objects[i] != NULL)
|
if (item->filter_objects[i] != NULL)
|
||||||
{
|
{
|
||||||
PluginList->InsertItem (i + shift, item->filter_objects[i]->GetPluginFormatDescription());
|
PluginList->InsertItem (i + shift,
|
||||||
|
item->filter_objects[i]->GetPluginFormatDescription());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -607,7 +616,8 @@ void RuleTableDropTarget::SetPrefs (ExtImportPrefs *prefs)
|
|||||||
mPrefs = prefs;
|
mPrefs = prefs;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDragResult RuleTableDropTarget::OnData(wxCoord x, wxCoord y, wxDragResult def)
|
wxDragResult RuleTableDropTarget::OnData(wxCoord x, wxCoord y,
|
||||||
|
wxDragResult def)
|
||||||
{
|
{
|
||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
@@ -623,15 +633,18 @@ bool RuleTableDropTarget::OnDrop(wxCoord x, wxCoord y)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDragResult RuleTableDropTarget::OnEnter(wxCoord x, wxCoord y, wxDragResult def)
|
wxDragResult RuleTableDropTarget::OnEnter(wxCoord x, wxCoord y,
|
||||||
|
wxDragResult def)
|
||||||
{
|
{
|
||||||
return OnDragOver(x, y, def);
|
return OnDragOver(x, y, def);
|
||||||
}
|
}
|
||||||
wxDragResult RuleTableDropTarget::OnDragOver(wxCoord x, wxCoord y, wxDragResult def)
|
wxDragResult RuleTableDropTarget::OnDragOver(wxCoord x, wxCoord y,
|
||||||
|
wxDragResult def)
|
||||||
{
|
{
|
||||||
if (mPrefs == NULL)
|
if (mPrefs == NULL)
|
||||||
return wxDragNone;
|
return wxDragNone;
|
||||||
int row = mPrefs->RuleTable->YToRow (y - mPrefs->RuleTable->GetColLabelSize ());
|
int row = mPrefs->RuleTable->YToRow (y -
|
||||||
|
mPrefs->RuleTable->GetColLabelSize ());
|
||||||
if (row == wxNOT_FOUND)
|
if (row == wxNOT_FOUND)
|
||||||
return wxDragNone;
|
return wxDragNone;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user