File: edtile.cpp

package info (click to toggle)
glhack 1.2-1
  • links: PTS
  • area: main
  • in suites: squeeze, wheezy
  • size: 24,604 kB
  • ctags: 18,992
  • sloc: ansic: 208,570; cpp: 13,139; yacc: 2,005; makefile: 1,161; lex: 377; sh: 321; awk: 89; sed: 11
file content (139 lines) | stat: -rw-r--r-- 3,162 bytes parent folder | download | duplicates (6)
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
//------------------------------------------------------------------------
//  EDTILE Program
//------------------------------------------------------------------------
//
//  EdTile (C) 2001-2002 Andrew Apted
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//------------------------------------------------------------------------

using namespace std;

#include "z_config.h"

#include <FL/Fl_File_Icon.H>

#include "z_args.h"
#include "z_string.h"

#include "w_main.h"
#include "w_browse.h"
#include "w_compact.h"
#include "w_edit.h"
#include "w_license.h"
#include "w_shades.h"
#include "z_hsv.h"
#include "t_colmap.h"
#include "t_hue.h"


static Tileset *work_set;


void DoSave()
{
  if (! work_set)
    return;

  work_set->Save("/tmp/out.txt");
}

static void ShowInfo()
{
  fprintf(stdout,
      "\n**** " PACKAGE_TITLE " " VERSION " ****\n\n"
      "Copyright (C) 2001-2002 Andrew Apted.\n"
      "Under the GNU General Public License (GPL).\n\n"
      "USAGE: edtile filename.txt\n\n"
  );

  fflush(stdout);
}

int main(int argc, const char **argv, const char **envp)
{
  if (argc > 1 &&
      (Z_String::CaseCmp(argv[1], "/?") == 0 ||
       Z_String::CaseCmp(argv[1], "-h") == 0 ||
       Z_String::CaseCmp(argv[1], "-help") == 0 ||
       Z_String::CaseCmp(argv[1], "--help") == 0))
  {
    ShowInfo();
    exit(0);
  }

  if (argc != 2)
  {
    fprintf(stderr, "USAGE: edtile filename.txt\n");
    exit(2);
  }
 

//// set defaults
//// MainSetDefaults();

  Z_Args::AddMany(argc - 1, argv + 1);
   
  // enable "as good as possible" RGB mode
  Fl::visual(FL_RGB);

  // load icons for file chooser
  Fl_File_Icon::load_system_icons();


  MainWin::appwin = new MainWin(0, 0,
      700 /* MainWin::min_w */, MainWin::min_h,
      PACKAGE_TITLE " " VERSION);


  T_Colmap::cmap16 = ColorMapping::Load("glhack/win/share/colors16.list");
  T_Colmap::cmap32 = ColorMapping::Load("glhack/win/share/colors32.list");


  work_set = Tileset::Load(Filename(argv[1]));

  work_set->cmap->trans_col = work_set->cmap->LookupExact(TRANS_COL);


  BrowserTab *btab = new BrowserTab();
  btab->ChangeTiles(work_set);
  btab->ChangeZoom(1);
  MainWin::appwin->AddTab(btab);


  CompactTab *ctab = new CompactTab();
  ctab->ChangeTiles(work_set);
  ctab->ChangeZoom(1);
  MainWin::appwin->AddTab(ctab);


  EditorTab *edtab = new EditorTab();
  edtab->ChangeTile(work_set, work_set->tiles + 0);
  MainWin::appwin->AddTab(edtab);


  HueSet *hue_set = new HueSet(T_Colmap::cmap32);
 

  ShadeTab *shtab = new ShadeTab();
  shtab->ChangeMap(hue_set);
  MainWin::appwin->AddTab(shtab);

 
  MainWin::appwin->ChangeTab(ctab);
  MainWin::appwin->RunModal();

  delete MainWin::appwin;


  return 0;
}