[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi] Allow opening cell editor with double-click
From: |
Vaclav Slavik |
Subject: |
[lmi] Allow opening cell editor with double-click |
Date: |
Fri, 30 Dec 2011 17:42:05 +0100 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:8.0) Gecko/20111105 Thunderbird/8.0 |
Hi,
I keep expecting double-clicking an entry in census view to open the editor,
but it doesn't. I think this expectation comes from other Windows UIs,
double-clicking ("activating") an item typically opens it.
Wouldn't it be better if LMI followed this convention? It's a simple change,
see the patch below.
Thanks,
Vaclav
diff --git a/census_view.cpp b/census_view.cpp
index cd7361a..5e1d848 100644
--- a/census_view.cpp
+++ b/census_view.cpp
@@ -808,6 +808,7 @@ inline std::vector<std::string> const&
CensusViewDataViewModel::all_headers() co
IMPLEMENT_DYNAMIC_CLASS(CensusView, ViewEx)
BEGIN_EVENT_TABLE(CensusView, ViewEx)
+ EVT_DATAVIEW_ITEM_ACTIVATED(ID_LISTWINDOW, CensusView::UponActivated)
EVT_DATAVIEW_ITEM_CONTEXT_MENU(ID_LISTWINDOW, CensusView::UponRightClick)
EVT_MENU(XRCID("edit_cell" ),CensusView::UponEditCell )
EVT_MENU(XRCID("edit_class" ),CensusView::UponEditClass)
@@ -1275,7 +1276,11 @@ wxMenuBar* CensusView::MenuBar() const
void CensusView::UponEditCell(wxCommandEvent&)
{
- int cell_number = selected_row();
+ edit_cell(selected_row());
+}
+
+void CensusView::edit_cell(int cell_number)
+{
Input& modifiable_parms = cell_parms()[cell_number];
std::string const title = cell_title(cell_number);
@@ -1359,6 +1364,11 @@ void CensusView::UponColumnWidthFixed(wxCommandEvent&)
}
}
+void CensusView::UponActivated(wxDataViewEvent& e)
+{
+ edit_cell(list_model_->GetRow(e.GetItem()));
+}
+
void CensusView::UponRightClick(wxDataViewEvent&)
{
wxMenu* census_menu = wxXmlResource::Get()->LoadMenu("census_menu_ref");
diff --git a/census_view.hpp b/census_view.hpp
index 34197ef..142befb 100644
--- a/census_view.hpp
+++ b/census_view.hpp
@@ -77,6 +77,7 @@ class CensusView
void UponColumnWidthVarying (wxCommandEvent&);
void UponColumnWidthFixed (wxCommandEvent&);
void UponPasteCensus (wxCommandEvent&);
+ void UponActivated (wxDataViewEvent&);
void UponRightClick (wxDataViewEvent&);
void UponPrintCase (wxCommandEvent&);
void UponPrintCaseToDisk (wxCommandEvent&);
@@ -128,6 +129,8 @@ class CensusView
void update_class_names();
+ void edit_cell(int cell_number);
+
bool all_changes_have_been_validated_;
bool autosize_columns_;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lmi] Allow opening cell editor with double-click,
Vaclav Slavik <=