~ubuntu-branches/ubuntu/lucid/codelite/lucid

« back to all changes in this revision

Viewing changes to LiteEditor/add_option_dialog.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Chow Loong Jin
  • Date: 2009-01-12 15:46:55 UTC
  • Revision ID: james.westby@ubuntu.com-20090112154655-sdynrljcb6u167yw
Tags: upstream-1.0.2674+dfsg
ImportĀ upstreamĀ versionĀ 1.0.2674+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//////////////////////////////////////////////////////////////////////////////
 
2
//////////////////////////////////////////////////////////////////////////////
 
3
//
 
4
// copyright            : (C) 2008 by Eran Ifrah                            
 
5
// file name            : add_option_dialog.cpp              
 
6
//                                                                          
 
7
// -------------------------------------------------------------------------
 
8
// A                                                                        
 
9
//              _____           _      _     _ _                            
 
10
//             /  __ \         | |    | |   (_) |                           
 
11
//             | /  \/ ___   __| | ___| |    _| |_ ___                      
 
12
//             | |    / _ \ / _  |/ _ \ |   | | __/ _ )                     
 
13
//             | \__/\ (_) | (_| |  __/ |___| | ||  __/                     
 
14
//              \____/\___/ \__,_|\___\_____/_|\__\___|                     
 
15
//                                                                          
 
16
//                                                  F i l e                 
 
17
//                                                                          
 
18
//    This program is free software; you can redistribute it and/or modify  
 
19
//    it under the terms of the GNU General Public License as published by  
 
20
//    the Free Software Foundation; either version 2 of the License, or     
 
21
//    (at your option) any later version.                                   
 
22
//                                                                          
 
23
//////////////////////////////////////////////////////////////////////////////
 
24
//////////////////////////////////////////////////////////////////////////////
 
25
 ///////////////////////////////////////////////////////////////////////////
 
26
// C++ code generated with wxFormBuilder (version May  5 2007)
 
27
// http://www.wxformbuilder.org/
 
28
//
 
29
// PLEASE DO "NOT" EDIT THIS FILE!
 
30
///////////////////////////////////////////////////////////////////////////
 
31
 
 
32
#ifdef WX_PRECOMP
 
33
 
 
34
#include "wx/wxprec.h"
 
35
 
 
36
#ifdef __BORLANDC__
 
37
#pragma hdrstop
 
38
#endif //__BORLANDC__
 
39
 
 
40
#else
 
41
#include <wx/wx.h>
 
42
#endif //WX_PRECOMP
 
43
 
 
44
#include "add_option_dialog.h"
 
45
#include "wx/tokenzr.h"
 
46
#include <wx/txtstrm.h>
 
47
#include <wx/sstream.h>
 
48
 
 
49
///////////////////////////////////////////////////////////////////////////
 
50
 
 
51
AddOptionDlg::AddOptionDlg( wxWindow* parent, wxString value, int id, wxString title, wxPoint pos, wxSize size, int style ) : wxDialog( parent, id, title, pos, size, style )
 
52
{
 
53
        this->SetSizeHints( wxDefaultSize, wxDefaultSize );
 
54
        
 
55
        wxBoxSizer* bSizer23;
 
56
        bSizer23 = new wxBoxSizer( wxVERTICAL );
 
57
        
 
58
        m_text = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_PROCESS_ENTER|wxTE_PROCESS_TAB|wxTE_RICH2);
 
59
        bSizer23->Add( m_text, 1, wxALL|wxEXPAND, 5 );
 
60
        
 
61
        m_staticline9 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
 
62
        bSizer23->Add( m_staticline9, 0, wxEXPAND | wxALL, 5 );
 
63
        
 
64
        wxBoxSizer* bSizer24;
 
65
        bSizer24 = new wxBoxSizer( wxHORIZONTAL );
 
66
        
 
67
        m_buttonOK = new wxButton( this, wxID_OK, wxT("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
 
68
        bSizer24->Add( m_buttonOK, 0, wxALL, 5 );
 
69
        
 
70
        m_buttonCancel = new wxButton( this, wxID_CANCEL, wxT("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
 
71
        bSizer24->Add( m_buttonCancel, 0, wxALL, 5 );
 
72
        
 
73
        bSizer23->Add( bSizer24, 0, wxALIGN_RIGHT, 5 );
 
74
        
 
75
        wxStringTokenizer tkz(value, wxT(";"));
 
76
        while(tkz.HasMoreTokens()){
 
77
                wxString token = tkz.GetNextToken();
 
78
                token = token.Trim();
 
79
                token = token.Trim(false);
 
80
                m_text->AppendText(token + wxT("\n"));  
 
81
        }
 
82
 
 
83
        this->SetSizer( bSizer23 );
 
84
        this->Layout();
 
85
}
 
86
 
 
87
wxString AddOptionDlg::GetValue() const
 
88
{
 
89
        wxStringInputStream input(m_text->GetValue());
 
90
        wxTextInputStream text(input);
 
91
 
 
92
        wxString value;
 
93
        while( !input.Eof() ){
 
94
 
 
95
                // Read the next line
 
96
                value += text.ReadLine();
 
97
                value += wxT(";");
 
98
        }
 
99
        return value.BeforeLast(wxT(';'));
 
100
}