File: vedapp.cpp

package info (click to toggle)
v1 1.17-4
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 5,812 kB
  • ctags: 6,780
  • sloc: cpp: 43,604; ansic: 5,003; makefile: 955; sh: 30
file content (110 lines) | stat: -rw-r--r-- 3,136 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
//=======================================================================
//@V@:Note: This file generated by vgen V1.00 (12:04:59 PM 23 Sep 1996).
//	vedapp.cpp:	Source for vedApp class
//=======================================================================

#include "vedapp.h"		// Header file

//=========================>>> vedApp::vedApp <<<==========================
  vedApp::vedApp(char* name, int sdi, int h, int w) : vApp(name, sdi, h, w)
  {
    // Constructor

   _vedCmdWin = 0;
  }

//=========================>>> vedApp::vedApp <<<==========================
  vedApp::~vedApp()
  {
    // Desstructor
//   if (_vedCmdWin)
//	delete _vedCmdWin;
  }

//=====================>>> vedApp::NewAppWin <<<==========================
  vWindow* vedApp::NewAppWin(vWindow* win, char* name,
    int w, int h, vAppWinInfo* winInfo)
  {
    vAppWinInfo* awinfo = winInfo;
    char *appname = name;

    if (!*name)
      {
	 appname = "V Text Editor";		// Default name
      }
	
    UserDebug1(Build,"vedApp::NewAppWin(%s)\n",appname);

    // Create the first window using provided CmdWindow

    _vedCmdWin = (vedCmdWindow*) win;
    if (!_vedCmdWin)
      {
	_vedCmdWin = new vedCmdWindow(appname, w, h);
      }

    if (!awinfo)
	awinfo = new vAppWinInfo(appname);

    return vApp::NewAppWin(_vedCmdWin, appname, w, h, awinfo);
  }

//============================>>> vedApp::Exit <<<===========================
  void vedApp::Exit(void)
  {
    // This is called to close all windows.

    UserDebug(Build,"vedApp::Exit()\n");

    vApp::Exit();		// Default behavior
  }

//======================>>> vedApp::CloseAppWin <<<===========================
  void vedApp::CloseAppWin(vWindow* win)
  {
    // This will be called BEFORE a window has been unregistered or
    // closed.  Default behavior: unregister and close the window.

    vedCmdWindow* cw = (vedCmdWindow*)win;
    if (cw->CheckClose())
        vApp::CloseAppWin(win);
  }

//=====================>>> vedApp::AppCommand <<<==============================
  void vedApp::AppCommand(vWindow* win, ItemVal id, ItemVal val, CmdType cType)
  {
    // Commands not processed by the window will be passed here

    UserDebug1(Build,"vedApp::AppCmd(ID: %d)\n",id);
    vApp::AppCommand(win, id, val, cType);
  }

//=========================>>> vedApp::KeyIn <<<==============================
  void vedApp::KeyIn(vWindow* win, vKey key, unsigned int shift)
  {
    // Key strokes not processed by the window will be passed here

    vApp::KeyIn(win, key, shift);
  }

//###########################################################################

  static vedApp ved_App("V Text Editor");	// The instance of the app

//============================>>> AppMain <<<==============================
  int AppMain(int argc, char** argv)
  {
    // Use AppMain to create the main window

    
    vedCmdWindow* cw;		// Pointer to instance of first window

    cw = (vedCmdWindow*) theApp->NewAppWin(0, "V Text Editor", 0, 0);
    if (argc > 1)
      {
	theApp->CheckEvents();	// make sure window up
	cw->OpenFile(argv[1]);	// open a file in first window
      }

    return 0;
  }