File: wx_IO.cpp

package info (click to toggle)
fityk 0.4.4-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,472 kB
  • ctags: 2,617
  • sloc: cpp: 19,705; sh: 5,965; xml: 2,325; yacc: 356; makefile: 183; lex: 178
file content (62 lines) | stat: -rw-r--r-- 1,452 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// This file is part of fityk program. Copyright (C) Marcin Wojdyr

// wxwindows headers, see wxwindows samples for description
#include <wx/wxprec.h>
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif

#include "common.h"
RCSID ("$Id: wx_IO.cpp,v 1.11 2005/03/04 14:28:46 wojdyr Exp $")

#include "ui.h"
#include "wx_plot.h"
#include "wx_gui.h"
#include "wx_pane.h"
#include "other.h"

using namespace std;

void UserInterface::showMessage (OutputStyle style, const string& s)
{
    frame->output_text(style, s + "\n");
}

void UserInterface::doDrawPlot(bool now, const std::vector<fp>& a)
{
        params4plot = a;
        frame->refresh_plots(true, now);
}


void UserInterface::wait (float seconds) 
{  
    wxUsleep (static_cast<int>(seconds*1e3)); //wxUsleep takes mili-seconds
}

void UserInterface::execCommand(const string& s)
{
    //FIXME should I limit number of displayed lines?
    //const int max_lines_in_output_win = 1000;
    string prompted_s = "=-> " + s;
    //don't output o.plot command - it is generated by every zoom in/out etc.
    bool output = strncmp(s.c_str(), "o.plot", 6) != 0;
    if (output)
        frame->output_text(os_input, prompted_s + "\n");
    else
        frame->set_status_text(s.c_str());
    wxBusyCursor wait;
    bool r = parser(s);
    if (!r)
        close();
    frame->refresh_plots(false, true);
}

void UserInterface::close()
{
        frame->Close(true);
}