Mercurial > mercurial > hgweb_qlipbrd.cgi
comparison src/mainframe.cpp @ 3:fd4361d2cbbd default tip
add remember function.
author | pyon@macmini |
---|---|
date | Thu, 24 Sep 2015 07:45:26 +0900 |
parents | e4aa0e7a07ad |
children |
comparison
equal
deleted
inserted
replaced
2:50d9f4e2a540 | 3:fd4361d2cbbd |
---|---|
1 // Filename: mainframe.cpp | 1 // Filename: mainframe.cpp |
2 // Last Change: 2015-09-13 Sun 14:43:27. | 2 // Last Change: 2015-09-24 Thu 07:41:29. |
3 // | 3 // |
4 #include <wx/filedlg.h> | 4 #include <wx/filedlg.h> |
5 #include <wx/textfile.h> | 5 #include <wx/textfile.h> |
6 #include <wx/clipbrd.h> | 6 #include <wx/clipbrd.h> |
7 #include <wx/utils.h> | 7 #include <wx/utils.h> |
19 #define COL_NO 0 | 19 #define COL_NO 0 |
20 #define COL_TEXT 1 | 20 #define COL_TEXT 1 |
21 #define COL_OW 2 | 21 #define COL_OW 2 |
22 #define COL_MLT 3 | 22 #define COL_MLT 3 |
23 #define COL_MAL 4 | 23 #define COL_MAL 4 |
24 #define COL_DESC 5 | 24 #define COL_REM 5 |
25 #define COL_ID 6 | 25 #define COL_DESC 6 |
26 #define COL_ID 7 | |
26 | 27 |
27 MainFrame::MainFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) | 28 MainFrame::MainFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) |
28 : wxFrame( parent, id, title, pos, size, style ), | 29 : wxFrame( parent, id, title, pos, size, style ), |
29 m_timer( this, ID_TIMER ), | 30 m_timer( this, ID_TIMER ), |
30 m_counter( 0 ), | 31 m_counter( 0 ), |
89 m_staticTextCycle = new wxStaticText( this, wxID_ANY, wxT("Cycle list"), wxDefaultPosition, wxDefaultSize, 0 ); | 90 m_staticTextCycle = new wxStaticText( this, wxID_ANY, wxT("Cycle list"), wxDefaultPosition, wxDefaultSize, 0 ); |
90 bSizerList->Add( m_staticTextCycle, 0, wxTOP|wxLEFT|wxALIGN_BOTTOM, 5 ); | 91 bSizerList->Add( m_staticTextCycle, 0, wxTOP|wxLEFT|wxALIGN_BOTTOM, 5 ); |
91 | 92 |
92 m_lisViewCycle = new wxListView( this, ID_LISTVIEW, wxDefaultPosition, wxSize( -1, 100 ), wxLC_REPORT|wxLC_SINGLE_SEL ); | 93 m_lisViewCycle = new wxListView( this, ID_LISTVIEW, wxDefaultPosition, wxSize( -1, 100 ), wxLC_REPORT|wxLC_SINGLE_SEL ); |
93 wxListItem itemCol; | 94 wxListItem itemCol; |
94 itemCol.SetText( wxT("No") ); m_lisViewCycle->InsertColumn( COL_NO, itemCol ); m_lisViewCycle->SetColumnWidth( COL_NO, 20 ); | 95 itemCol.SetText( wxT("No") ); m_lisViewCycle->InsertColumn( COL_NO, itemCol ); m_lisViewCycle->SetColumnWidth( COL_NO, 20 ); |
95 itemCol.SetText( wxT("text") ); m_lisViewCycle->InsertColumn( COL_TEXT, itemCol ); m_lisViewCycle->SetColumnWidth( COL_TEXT, 80 ); | 96 itemCol.SetText( wxT("text") ); m_lisViewCycle->InsertColumn( COL_TEXT, itemCol ); m_lisViewCycle->SetColumnWidth( COL_TEXT, 80 ); |
96 itemCol.SetText( wxT("o/w") ); m_lisViewCycle->InsertColumn( COL_OW, itemCol ); m_lisViewCycle->SetColumnWidth( COL_OW, 40 ); | 97 itemCol.SetText( wxT("o/w") ); m_lisViewCycle->InsertColumn( COL_OW, itemCol ); m_lisViewCycle->SetColumnWidth( COL_OW, 40 ); |
97 itemCol.SetText( wxT("live") ); m_lisViewCycle->InsertColumn( COL_MLT, itemCol ); m_lisViewCycle->SetColumnWidth( COL_MLT, 50 ); | 98 itemCol.SetText( wxT("live") ); m_lisViewCycle->InsertColumn( COL_MLT, itemCol ); m_lisViewCycle->SetColumnWidth( COL_MLT, 50 ); |
98 itemCol.SetText( wxT("active") ); m_lisViewCycle->InsertColumn( COL_MAL, itemCol ); m_lisViewCycle->SetColumnWidth( COL_MAL, 50 ); | 99 itemCol.SetText( wxT("act.") ); m_lisViewCycle->InsertColumn( COL_MAL, itemCol ); m_lisViewCycle->SetColumnWidth( COL_MAL, 50 ); |
99 itemCol.SetText( wxT("desc") ); m_lisViewCycle->InsertColumn( COL_DESC, itemCol ); m_lisViewCycle->SetColumnWidth( COL_DESC, 80 ); | 100 itemCol.SetText( wxT("rem.") ); m_lisViewCycle->InsertColumn( COL_REM, itemCol ); m_lisViewCycle->SetColumnWidth( COL_REM, 40 ); |
100 itemCol.SetText( wxT("id") ); m_lisViewCycle->InsertColumn( COL_ID, itemCol ); m_lisViewCycle->SetColumnWidth( COL_ID, 30 ); | 101 itemCol.SetText( wxT("desc") ); m_lisViewCycle->InsertColumn( COL_DESC, itemCol ); m_lisViewCycle->SetColumnWidth( COL_DESC, 80 ); |
102 itemCol.SetText( wxT("id") ); m_lisViewCycle->InsertColumn( COL_ID, itemCol ); m_lisViewCycle->SetColumnWidth( COL_ID, 30 ); | |
101 //m_lisViewCycle->EnableAlternateRowColours( true ); | 103 //m_lisViewCycle->EnableAlternateRowColours( true ); |
102 bSizerList->Add( m_lisViewCycle, 1, wxALL|wxEXPAND, 5 ); | 104 bSizerList->Add( m_lisViewCycle, 1, wxALL|wxEXPAND, 5 ); |
103 | 105 |
104 m_staticTextHist = new wxStaticText( this, wxID_ANY, wxT("User input history"), wxDefaultPosition, wxDefaultSize, 0 ); | 106 m_staticTextHist = new wxStaticText( this, wxID_ANY, wxT("User input history"), wxDefaultPosition, wxDefaultSize, 0 ); |
105 bSizerList->Add( m_staticTextHist, 0, wxTOP|wxLEFT|wxALIGN_BOTTOM, 5 ); | 107 bSizerList->Add( m_staticTextHist, 0, wxTOP|wxLEFT|wxALIGN_BOTTOM, 5 ); |
323 q->id = id; | 325 q->id = id; |
324 q->text = add_dlg.GetText(); | 326 q->text = add_dlg.GetText(); |
325 q->overwrite = add_dlg.GetOverwrite(); | 327 q->overwrite = add_dlg.GetOverwrite(); |
326 q->max_active_time = add_dlg.GetMaxActiveTime(); | 328 q->max_active_time = add_dlg.GetMaxActiveTime(); |
327 q->max_live_time = q->overwrite ? add_dlg.GetMaxLiveTime() : 0; | 329 q->max_live_time = q->overwrite ? add_dlg.GetMaxLiveTime() : 0; |
330 q->remember = add_dlg.GetRemember(); | |
328 q->desc = add_dlg.GetDesc(); | 331 q->desc = add_dlg.GetDesc(); |
329 q->active_time = 0; | 332 q->active_time = 0; |
330 q->live_time = 0; | 333 q->live_time = 0; |
331 QH[id] = q; | 334 QH[id] = q; |
332 | 335 |
551 } | 554 } |
552 | 555 |
553 void MainFrame::UpdateHistory( wxString s ) | 556 void MainFrame::UpdateHistory( wxString s ) |
554 { | 557 { |
555 if ( s.IsEmpty() ) return; | 558 if ( s.IsEmpty() ) return; |
559 | |
560 QlipDataHash::iterator it; | |
561 for ( it = QH.begin(); it != QH.end(); it++ ) { | |
562 QlipData* q = it->second; | |
563 if ( s.IsSameAs( q->text ) ) return; | |
564 } | |
565 | |
556 int row = m_listBoxHist->FindString( s, true ); | 566 int row = m_listBoxHist->FindString( s, true ); |
557 if ( row != wxNOT_FOUND ) | 567 if ( row != wxNOT_FOUND ) |
558 m_listBoxHist->Delete( row ); | 568 m_listBoxHist->Delete( row ); |
559 m_listBoxHist->Insert( s, 0 ); | 569 m_listBoxHist->Insert( s, 0 ); |
560 } | 570 } |