OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [host/] [tools/] [configtool/] [standalone/] [wxwin/] [outputwin.cpp] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
// ####ECOSHOSTGPLCOPYRIGHTBEGIN####                                        
2
// -------------------------------------------                              
3
// This file is part of the eCos host tools.                                
4
// Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.            
5
//
6
// This program is free software; you can redistribute it and/or modify     
7
// it under the terms of the GNU General Public License as published by     
8
// the Free Software Foundation; either version 2 or (at your option) any   
9
// later version.                                                           
10
//
11
// This program is distributed in the hope that it will be useful, but      
12
// WITHOUT ANY WARRANTY; without even the implied warranty of               
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU        
14
// General Public License for more details.                                 
15
//
16
// You should have received a copy of the GNU General Public License        
17
// along with this program; if not, write to the                            
18
// Free Software Foundation, Inc., 51 Franklin Street,                      
19
// Fifth Floor, Boston, MA  02110-1301, USA.                                
20
// -------------------------------------------                              
21
// ####ECOSHOSTGPLCOPYRIGHTEND####                                          
22
// outputwin.cpp :
23
//
24
//===========================================================================
25
//#####DESCRIPTIONBEGIN####
26
//
27
// Author(s):   julians
28
// Contact(s):  julians
29
// Date:        2000/10/02
30
// Version:     $Id: outputwin.cpp,v 1.2 2001/04/24 14:39:13 julians Exp $
31
// Purpose:
32
// Description: Implementation file for ecOutputWindow
33
// Requires:
34
// Provides:
35
// See also:
36
// Known bugs:
37
// Usage:
38
//
39
//####DESCRIPTIONEND####
40
//
41
//===========================================================================
42
 
43
// ============================================================================
44
// declarations
45
// ============================================================================
46
 
47
// ----------------------------------------------------------------------------
48
// headers
49
// ----------------------------------------------------------------------------
50
#ifdef __GNUG__
51
    #pragma implementation "outputwin.h"
52
#endif
53
 
54
// Includes other headers for precompiled compilation
55
#include "ecpch.h"
56
 
57
#ifdef __BORLANDC__
58
    #pragma hdrstop
59
#endif
60
 
61
#include "configtool.h"
62
#include "outputwin.h"
63
 
64
/*
65
 * ecOutputWindow
66
 */
67
 
68
IMPLEMENT_CLASS(ecOutputWindow, wxTextCtrl)
69
 
70
BEGIN_EVENT_TABLE(ecOutputWindow, wxTextCtrl)
71
//    EVT_PAINT(ecOutputWindow::OnPaint)
72
    EVT_MOUSE_EVENTS(ecOutputWindow::OnMouseEvent)
73
    EVT_MENU(wxID_CLEAR, ecOutputWindow::OnClear)
74
    EVT_MENU(wxID_SELECTALL, ecOutputWindow::OnSelectAll)
75
    EVT_MENU(wxID_SAVE, ecOutputWindow::OnSave)
76
    EVT_UPDATE_UI(wxID_CLEAR, ecOutputWindow::OnUpdateClear)
77
    EVT_UPDATE_UI(wxID_SAVE, ecOutputWindow::OnUpdateSave)
78
END_EVENT_TABLE()
79
 
80
ecOutputWindow::ecOutputWindow(wxWindow* parent, wxWindowID id, const wxPoint& pt,
81
        const wxSize& sz, long style):
82
        wxTextCtrl(parent, id, wxEmptyString, pt, sz, style)
83
{
84
    if (!wxGetApp().GetSettings().GetWindowSettings().GetUseDefaults() &&
85
         wxGetApp().GetSettings().GetWindowSettings().GetFont(wxT("Output")).Ok())
86
    {
87
        SetFont(wxGetApp().GetSettings().GetWindowSettings().GetFont(wxT("Output")));
88
    }
89
 
90
    m_propertiesMenu = new wxMenu;
91
 
92
    m_propertiesMenu->Append(ecID_WHATS_THIS, _("&What's This?"));
93
    m_propertiesMenu->AppendSeparator();
94
    m_propertiesMenu->Append(wxID_COPY, _("&Copy"));
95
    m_propertiesMenu->Append(wxID_CLEAR, _("C&lear"));
96
    m_propertiesMenu->Append(wxID_SELECTALL, _("Select &All"));
97
    m_propertiesMenu->AppendSeparator();
98
    m_propertiesMenu->Append(wxID_SAVE, _("&Save..."));
99
}
100
 
101
ecOutputWindow::~ecOutputWindow()
102
{
103
    delete m_propertiesMenu;
104
}
105
 
106
void ecOutputWindow::OnMouseEvent(wxMouseEvent& event)
107
{
108
    if (event.RightDown())
109
    {
110
        PopupMenu(GetPropertiesMenu(), event.GetX(), event.GetY());
111
    }
112
    else
113
    {
114
        event.Skip();
115
    }
116
}
117
 
118
void ecOutputWindow::OnClear(wxCommandEvent& event)
119
{
120
    Clear();
121
}
122
 
123
void ecOutputWindow::OnSelectAll(wxCommandEvent& event)
124
{
125
    SetSelection(0, GetLastPosition());
126
}
127
 
128
void ecOutputWindow::OnSave(wxCommandEvent& event)
129
{
130
    wxFileDialog dialog(this, _("Save output as"),
131
        wxT(""), wxT("output.txt"), wxT("*.txt"), wxSAVE|wxOVERWRITE_PROMPT);
132
    if (dialog.ShowModal() == wxID_OK)
133
    {
134
        if (!SaveFile(dialog.GetPath()))
135
        {
136
            wxMessageBox(_("Error saving output file."), wxGetApp().GetSettings().GetAppName(),
137
                wxICON_EXCLAMATION|wxID_OK);
138
        }
139
    }
140
}
141
 
142
void ecOutputWindow::OnUpdateClear(wxUpdateUIEvent& event)
143
{
144
    event.Enable(!IsEmpty());
145
}
146
 
147
void ecOutputWindow::OnUpdateSave(wxUpdateUIEvent& event)
148
{
149
    event.Enable(!IsEmpty());
150
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.