Removed FLTK-based GUIs

This commit is contained in:
yvt 2014-02-24 19:02:13 +09:00
parent 5101172f23
commit e33cd5644c
15 changed files with 66 additions and 989 deletions

View File

@ -24,9 +24,6 @@
E80B289917AA64020056179E /* GLWaterRenderer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E80B289717AA63FC0056179E /* GLWaterRenderer.cpp */; };
E80B28BE17ABB2590056179E /* kiss_fft.c in Sources */ = {isa = PBXBuildFile; fileRef = E80B28B817ABAC790056179E /* kiss_fft.c */; };
E80B28C117AE7FF20056179E /* GLAmbientShadowRenderer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E80B28BF17AE7FEB0056179E /* GLAmbientShadowRenderer.cpp */; };
E80B28C417AF85320056179E /* DetailConfigWindow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E80B28C217AF85300056179E /* DetailConfigWindow.cpp */; };
E80B28C717AF872C0056179E /* DetailConfigWindowHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E80B28C517AF872A0056179E /* DetailConfigWindowHandler.cpp */; };
E80B28CA17AF8A480056179E /* DetailConfigTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E80B28C817AF8A450056179E /* DetailConfigTable.cpp */; };
E80B28CD17AFCCCB0056179E /* PaletteView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E80B28CB17AFCCC40056179E /* PaletteView.cpp */; };
E80B28D017AFE68A0056179E /* TCGameMode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E80B28CE17AFE68A0056179E /* TCGameMode.cpp */; };
E80B28D317AFF7810056179E /* TCProgressView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E80B28D117AFF77B0056179E /* TCProgressView.cpp */; };
@ -70,7 +67,6 @@
E844888317D2633C005105D0 /* json_value.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E844887C17D2633C005105D0 /* json_value.cpp */; };
E844888417D2633C005105D0 /* json_writer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E844887E17D2633C005105D0 /* json_writer.cpp */; };
E844888717D2669C005105D0 /* libcurl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = E844888617D26699005105D0 /* libcurl.dylib */; };
E844888A17D39CD3005105D0 /* ErrorDialog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E844888817D39CD0005105D0 /* ErrorDialog.cpp */; };
E84E221618BB4601001282B0 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = E8CF039B178EDAC9000683D4 /* libz.dylib */; };
E84E221718BB4B41001282B0 /* libfltk.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E8CF03E4178EF5FF000683D4 /* libfltk.a */; };
E84E221918BB4BA0001282B0 /* Credits.inc in Sources */ = {isa = PBXBuildFile; fileRef = E84E221818BB4BA0001282B0 /* Credits.inc */; };
@ -324,11 +320,6 @@
E80B28BC17ABAC790056179E /* README.simd */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.simd; sourceTree = "<group>"; };
E80B28BF17AE7FEB0056179E /* GLAmbientShadowRenderer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GLAmbientShadowRenderer.cpp; sourceTree = "<group>"; };
E80B28C017AE7FEE0056179E /* GLAmbientShadowRenderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GLAmbientShadowRenderer.h; sourceTree = "<group>"; };
E80B28C217AF85300056179E /* DetailConfigWindow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DetailConfigWindow.cpp; sourceTree = "<group>"; };
E80B28C317AF85310056179E /* DetailConfigWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetailConfigWindow.h; sourceTree = "<group>"; };
E80B28C517AF872A0056179E /* DetailConfigWindowHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DetailConfigWindowHandler.cpp; sourceTree = "<group>"; };
E80B28C817AF8A450056179E /* DetailConfigTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DetailConfigTable.cpp; sourceTree = "<group>"; };
E80B28C917AF8A470056179E /* DetailConfigTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetailConfigTable.h; sourceTree = "<group>"; };
E80B28CB17AFCCC40056179E /* PaletteView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PaletteView.cpp; sourceTree = "<group>"; };
E80B28CC17AFCCC70056179E /* PaletteView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PaletteView.h; sourceTree = "<group>"; };
E80B28CE17AFE68A0056179E /* TCGameMode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TCGameMode.cpp; sourceTree = "<group>"; };
@ -428,8 +419,6 @@
E844888117D2633C005105D0 /* version */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = version; sourceTree = "<group>"; };
E844888517D26411005105D0 /* OpenSpades.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenSpades.h; sourceTree = SOURCE_ROOT; };
E844888617D26699005105D0 /* libcurl.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcurl.dylib; path = usr/lib/libcurl.dylib; sourceTree = SDKROOT; };
E844888817D39CD0005105D0 /* ErrorDialog.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ErrorDialog.cpp; sourceTree = "<group>"; };
E844888917D39CD2005105D0 /* ErrorDialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ErrorDialog.h; sourceTree = "<group>"; };
E844888B17D3A059005105D0 /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
E84E221318BB449A001282B0 /* FindGLEW2.cmake */ = {isa = PBXFileReference; lastKnownFileType = text; path = FindGLEW2.cmake; sourceTree = "<group>"; };
E84E221418BB449A001282B0 /* FindSDL2.cmake */ = {isa = PBXFileReference; lastKnownFileType = text; path = FindSDL2.cmake; sourceTree = "<group>"; };
@ -1387,12 +1376,8 @@
children = (
E8F74CEC183F931F0085AA54 /* SDLMain.h */,
E8F74CEA183F92DA0085AA54 /* SDLmain.m */,
E844888817D39CD0005105D0 /* ErrorDialog.cpp */,
E844888917D39CD2005105D0 /* ErrorDialog.h */,
E844886817D262E3005105D0 /* Serverbrowser.cpp */,
E844886917D262E4005105D0 /* Serverbrowser.h */,
E80B28C217AF85300056179E /* DetailConfigWindow.cpp */,
E80B28C317AF85310056179E /* DetailConfigWindow.h */,
E8CF03BE178EE50E000683D4 /* Main.cpp */,
E8F74CE6183F8A110085AA54 /* Main.h */,
E8CF03BB178EE502000683D4 /* SDLGLDevice.cpp */,
@ -1401,9 +1386,6 @@
E8CF03E2178EF57E000683D4 /* SDLRunner.h */,
E80B289117A683500056179E /* SDLAsyncRunner.cpp */,
E80B289217A683500056179E /* SDLAsyncRunner.h */,
E80B28C517AF872A0056179E /* DetailConfigWindowHandler.cpp */,
E80B28C817AF8A450056179E /* DetailConfigTable.cpp */,
E80B28C917AF8A470056179E /* DetailConfigTable.h */,
E80B28D417B1100D0056179E /* AboutText.html */,
E81CE4A7183F7F2000F22685 /* MainScreen.cpp */,
E81CE4A8183F7F2000F22685 /* MainScreen.h */,
@ -1969,9 +1951,6 @@
E80B289917AA64020056179E /* GLWaterRenderer.cpp in Sources */,
E80B28BE17ABB2590056179E /* kiss_fft.c in Sources */,
E80B28C117AE7FF20056179E /* GLAmbientShadowRenderer.cpp in Sources */,
E80B28C417AF85320056179E /* DetailConfigWindow.cpp in Sources */,
E80B28C717AF872C0056179E /* DetailConfigWindowHandler.cpp in Sources */,
E80B28CA17AF8A480056179E /* DetailConfigTable.cpp in Sources */,
E80B28CD17AFCCCB0056179E /* PaletteView.cpp in Sources */,
E81A7C6B1861525D00BF3FCE /* SWImage.cpp in Sources */,
E80B28D017AFE68A0056179E /* TCGameMode.cpp in Sources */,
@ -1994,7 +1973,6 @@
E844888217D2633C005105D0 /* json_reader.cpp in Sources */,
E844888317D2633C005105D0 /* json_value.cpp in Sources */,
E844888417D2633C005105D0 /* json_writer.cpp in Sources */,
E844888A17D39CD3005105D0 /* ErrorDialog.cpp in Sources */,
E8D2ACE317D704E600BE5490 /* GLColorCorrectionFilter.cpp in Sources */,
E8B6B68F17DE27B500E35523 /* as_atomic.cpp in Sources */,
E8B6B69017DE27B500E35523 /* as_builder.cpp in Sources */,

View File

@ -20,6 +20,7 @@ msgstr ""
"X-Source-Language: C\n"
#: ../../../Sources/Gui/Main.cpp:344 ../../../Sources/Gui/Main.cpp:369
#: ../../../Sources/Gui/Main.cpp:368
msgctxt "Main"
msgid "Localization System Loaded"
msgstr "ローカライゼーションシステムが読み込まれました"
@ -1073,16 +1074,39 @@ msgid "{0} wins!"
msgstr "{0} の勝ち!"
#: ../../../Sources/Client/Client.cpp:3443
#: ../../../Sources/Client/Client.cpp:3442
msgctxt "Client"
msgid "{0} Wins!"
msgstr "{0} の勝ち!"
#: ../../../Sources/Client/Client.cpp:3834
#: ../../../Sources/Client/Client.cpp:3833
msgctxt "Client"
msgid "You have killed {0}"
msgstr "{0} を殺害しました"
#: ../../../Sources/Client/Client.cpp:3836
#: ../../../Sources/Client/Client.cpp:3835
msgctxt "Client"
msgid "You were killed by {0}"
msgstr "{0} に殺害されました"
#: ../../../Sources/Gui/Main.cpp:401
msgctxt "Main"
msgid ""
"A serious error caused OpenSpades to stop working:\n"
"\n"
"{0}\n"
"\n"
"See SystemMessages.log for more details."
msgstr ""
"深刻な問題により、OpenSpadesは動作を停止しました:\n"
"\n"
"{0}\n"
"\n"
"詳細については SystemMessages.log をご覧下さい。"
#: ../../../Sources/Gui/Main.cpp:406
msgctxt "Main"
msgid "OpenSpades Fatal Error"
msgstr "OpenSpades 重大なエラー"

View File

@ -18,6 +18,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
#: ../../../Sources/Gui/Main.cpp:344 ../../../Sources/Gui/Main.cpp:369
#: ../../../Sources/Gui/Main.cpp:368
msgctxt "Main"
msgid "Localization System Loaded"
msgstr ""
@ -1053,16 +1054,34 @@ msgid "{0} wins!"
msgstr ""
#: ../../../Sources/Client/Client.cpp:3443
#: ../../../Sources/Client/Client.cpp:3442
msgctxt "Client"
msgid "{0} Wins!"
msgstr ""
#: ../../../Sources/Client/Client.cpp:3834
#: ../../../Sources/Client/Client.cpp:3833
msgctxt "Client"
msgid "You have killed {0}"
msgstr ""
#: ../../../Sources/Client/Client.cpp:3836
#: ../../../Sources/Client/Client.cpp:3835
msgctxt "Client"
msgid "You were killed by {0}"
msgstr ""
#: ../../../Sources/Gui/Main.cpp:401
msgctxt "Main"
msgid ""
"A serious error caused OpenSpades to stop working:\n"
"\n"
"{0}\n"
"\n"
"See SystemMessages.log for more details."
msgstr ""
#: ../../../Sources/Gui/Main.cpp:406
msgctxt "Main"
msgid "OpenSpades Fatal Error"
msgstr ""

View File

@ -1,242 +0,0 @@
/*
Copyright (c) 2013 yvt
This file is part of OpenSpades.
OpenSpades 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 3 of the License, or
(at your option) any later version.
OpenSpades 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.
You should have received a copy of the GNU General Public License
along with OpenSpades. If not, see <http://www.gnu.org/licenses/>.
*/
#include "DetailConfigTable.h"
#include <FL/Fl_Window.H>
#include "../Core/Settings.h"
#include <FL/fl_draw.H>
#include <algorithm>
DetailConfigTable::DetailConfigTable(int X,int Y,int W,int H,const char* L) : Fl_Table(X,Y,W,H,L) {
callback(&event_callback, (void*)this);
when(FL_WHEN_NOT_CHANGED|when());
// Create input widget that we'll use whenever user clicks on a cell
input = new Fl_Input(W/2,H/2,0,0);
input->hide();
input->callback(input_cb, (void*)this);
input->when(FL_WHEN_ENTER_KEY_ALWAYS); // callback triggered when user hits Enter
input->maximum_size(256);
input->textsize(12);
input->box(FL_THIN_UP_BOX);
row_edit = col_edit = 0;
s_left = s_top = s_right = s_bottom = 0;
mAllItems = spades::Settings::GetInstance()->GetAllItemNames();
filterUpdated();
}
bool iEqual( char left, char right )
{
return toupper(left) == toupper(right);
}
void DetailConfigTable::setFilter( const char* newFilter )
{
if( mFilter != newFilter ) {
mFilter = newFilter;
filterUpdated();
}
}
void DetailConfigTable::filterUpdated()
{
mFilteredItems.clear();
for( size_t n = 0; n < mAllItems.size(); ++n ) {
std::string& cur = mAllItems[n];
if( cur.end() != std::search( cur.begin(), cur.end(), mFilter.begin(), mFilter.end(), iEqual ) ) {
mFilteredItems.push_back( cur );
}
}
begin();
row_header(0);
rows(mFilteredItems.size());
cols(2);
col_width(0, 250);
col_width(1, 300);
row_height_all(20);
end();
}
void DetailConfigTable::set_value_hide() {
spades::Settings::ItemHandle item(mFilteredItems[row_edit]);
std::string old = item;
std::string newv = input->value();
if(old != newv){
item = newv;
}
input->hide();
window()->cursor(FL_CURSOR_DEFAULT); // XXX: if we don't do this, cursor can disappear!
}
void DetailConfigTable::done_editing() {
if (input->visible()) { // input widget visible, ie. edit in progress?
set_value_hide(); // Transfer its current contents to cell and hide
}
}
void DetailConfigTable::start_editing(int R, int C) {
spades::Settings::ItemHandle item(mFilteredItems[R]);
row_edit = R; // Now editing this row/col
col_edit = C;
int X,Y,W,H;
find_cell(CONTEXT_CELL, R,C, X,Y,W,H); // Find X/Y/W/H of cell
input->resize(X,Y,W,H); // Move Fl_Input widget there
std::string s = item;
input->value(s.c_str());
input->position(0,s.size()); // Select entire input field
input->show(); // Show the input widget, now that we've positioned it
input->take_focus();
}
void DetailConfigTable::event_callback2() {
int R = callback_row();
int C = callback_col();
TableContext context = callback_context();
switch ( context ) {
case CONTEXT_CELL: { // A table event occurred on a cell
switch (Fl::event()) { // see what FLTK event caused it
case FL_PUSH: // mouse click?
done_editing(); // finish editing previous
if (C == 1) // only edit value
start_editing(R,C); // start new edit
return;
/*
case FL_KEYBOARD: // key press in table?
if ( Fl::event_key() == FL_Escape ) exit(0); // ESC closes app
if (C == 0) return; // no editing column
done_editing(); // finish any previous editing
set_selection(R, C, R, C); // select the current cell
start_editing(R,C); // start new edit
if (Fl::event() == FL_KEYBOARD && Fl::e_text[0] != '\r') {
input->handle(Fl::event()); // pass keypress to input widget
}
return;*/
}
return;
}
case CONTEXT_TABLE: // A table event occurred on dead zone in table
case CONTEXT_ROW_HEADER: // A table event occurred on row/column header
case CONTEXT_COL_HEADER:
done_editing(); // done editing, hide
return;
default:
return;
}
}
void DetailConfigTable::draw_cell(TableContext context, int R,int C, int X,int Y,int W,int H) {
//static char s[30];
switch ( context ) {
case CONTEXT_STARTPAGE: // table about to redraw
// Get kb nav + mouse 'selection region' for use below
get_selection(s_top, s_left, s_bottom, s_right);
break;
case CONTEXT_COL_HEADER: // table wants us to draw a column heading (C is column)
fl_font(FL_HELVETICA | FL_BOLD, 12); // set font for heading to bold
fl_push_clip(X,Y,W,H); // clip region for text
{
fl_draw_box(FL_THIN_UP_BOX, X,Y,W,H, col_header_color());
fl_color(FL_FOREGROUND_COLOR);
const char *str;
if(C == 0){
str = "Name";
}else{
str = "Value";
}
fl_draw(str, X,Y,W,H, FL_ALIGN_CENTER);
}
fl_pop_clip();
return;
case CONTEXT_ROW_HEADER: // table wants us to draw a row heading (R is row)
/* fl_font(FL_HELVETICA | FL_BOLD, 14); // set font for row heading to bold
fl_push_clip(X,Y,W,H);
{
fl_draw_box(FL_THIN_UP_BOX, X,Y,W,H, row_header_color());
fl_color(FL_BLACK);
if (R == rows()-1) { // Last row? Show 'Total'
fl_draw("TOTAL", X,Y,W,H, FL_ALIGN_CENTER);
} else { // Not last row? show row#
sprintf(s, "%d", R+1);
fl_draw(s, X,Y,W,H, FL_ALIGN_CENTER);
}
}
fl_pop_clip();*/
return;
case CONTEXT_CELL: { // table wants us to draw a cell
if (R == row_edit && C == col_edit && input->visible()) {
return; // dont draw for cell with input widget over it
}
// Background
// Keyboard nav and mouse selection highlighting
if ( C == 1 ) {
fl_draw_box(FL_THIN_UP_BOX, X,Y,W,H, FL_BACKGROUND2_COLOR);
} else { // header
fl_draw_box(FL_THIN_UP_BOX, X,Y,W,H, FL_BACKGROUND_COLOR);
}
// Text
fl_push_clip(X+3, Y+3, W-6, H-6);
{
fl_color(FL_FOREGROUND_COLOR);
fl_font(FL_HELVETICA, 12); // ..in regular font
spades::Settings::ItemHandle item(mFilteredItems[R]);
const char *str;
if(C == 0){
str = mFilteredItems[R].c_str();
}else{
str = item.CString();
}
fl_draw(str, X+3,Y+3,W-6,H-6, FL_ALIGN_LEFT);
}
fl_pop_clip();
return;
}
case CONTEXT_RC_RESIZE: { // table resizing rows or columns
if (!input->visible()) return;
find_cell(CONTEXT_TABLE, row_edit, col_edit, X, Y, W, H);
if (X==input->x() && Y==input->y() && W==input->w() && H==input->h()) {
return; // no change? ignore
}
input->resize(X,Y,W,H);
return;
}
default:
return;
}
}

View File

@ -1,58 +0,0 @@
/*
Copyright (c) 2013 yvt
This file is part of OpenSpades.
OpenSpades 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 3 of the License, or
(at your option) any later version.
OpenSpades 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.
You should have received a copy of the GNU General Public License
along with OpenSpades. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <FL/Fl_Table.H>
#include <FL/Fl_Input.H>
#include <vector>
#include <string>
class DetailConfigTable: public Fl_Table {
std::vector<std::string> mAllItems;
std::vector<std::string> mFilteredItems;
std::string mFilter;
Fl_Input *input;
int row_edit, col_edit; // row/col being modified
int s_left, s_top, s_right, s_bottom; // kb nav + mouse selection
void done_editing();
void set_value_hide();
void start_editing(int R, int C);
void event_callback2(); // table's event callback (instance)
static void event_callback(Fl_Widget*, void *v) { // table's event callback (static)
((DetailConfigTable*)v)->event_callback2();
}
static void input_cb(Fl_Widget*, void* v) { // input widget's callback
((DetailConfigTable*)v)->set_value_hide();
}
protected:
void filterUpdated();
virtual void draw_cell(TableContext context, int R,int C, int X,int Y,int W,int H);
public:
DetailConfigTable(int X,int Y,int W,int H,const char* L=0);
~DetailConfigTable() { }
void setFilter( const char* newFilter );
void EndEditing() { done_editing(); }
};

View File

@ -1,66 +0,0 @@
// generated by Fast Light User Interface Designer (fluid) version 1.0302
#include "DetailConfigWindow.h"
void DetailConfigWindow::cb_Dismiss_i(Fl_Return_Button*, void*) {
table->EndEditing();
hide();
}
void DetailConfigWindow::cb_Dismiss(Fl_Return_Button* o, void* v) {
((DetailConfigWindow*)(o->parent()))->cb_Dismiss_i(o,v);
}
void DetailConfigWindow::cb_inputFilter_i(Fl_Input*, void*) {
onFilterChange();
}
void DetailConfigWindow::cb_inputFilter(Fl_Input* o, void* v) {
((DetailConfigWindow*)(o->parent()))->cb_inputFilter_i(o,v);
}
DetailConfigWindow::DetailConfigWindow(int X, int Y, int W, int H, const char *L)
: Fl_Window(X, Y, W, H, L) {
_DetailConfigWindow();
}
DetailConfigWindow::DetailConfigWindow(int W, int H, const char *L)
: Fl_Window(0, 0, W, H, L) {
clear_flag(16);
_DetailConfigWindow();
}
DetailConfigWindow::DetailConfigWindow()
: Fl_Window(0, 0, 591, 513, "Advanced Settings") {
clear_flag(16);
_DetailConfigWindow();
}
void DetailConfigWindow::_DetailConfigWindow() {
this->box(FL_FLAT_BOX);
this->color(FL_BACKGROUND_COLOR);
this->selection_color(FL_BACKGROUND_COLOR);
this->labeltype(FL_NO_LABEL);
this->labelfont(0);
this->labelsize(14);
this->labelcolor(FL_FOREGROUND_COLOR);
this->align(Fl_Align(FL_ALIGN_TOP));
this->when(FL_WHEN_RELEASE);
{ Fl_Return_Button* o = new Fl_Return_Button(480, 475, 100, 25, "Dismiss");
o->callback((Fl_Callback*)cb_Dismiss);
} // Fl_Return_Button* o
{ table = new DetailConfigTable(10, 35, 570, 430);
table->box(FL_THIN_DOWN_FRAME);
table->color(FL_BACKGROUND_COLOR);
table->selection_color(FL_BACKGROUND_COLOR);
table->labeltype(FL_NORMAL_LABEL);
table->labelfont(0);
table->labelsize(14);
table->labelcolor(FL_FOREGROUND_COLOR);
table->align(Fl_Align(FL_ALIGN_TOP));
table->when(FL_WHEN_RELEASE);
table->end();
} // DetailConfigTable* table
{ inputFilter = new Fl_Input(50, 11, 530, 24, "Filter:");
inputFilter->callback((Fl_Callback*)cb_inputFilter);
inputFilter->when(FL_WHEN_CHANGED);
} // Fl_Input* inputFilter
end();
}

View File

@ -1,28 +0,0 @@
# data file for the Fltk User Interface Designer (fluid)
version 1.0302
header_name {.h}
code_name {.cpp}
widget_class DetailConfigWindow {
label {Advanced Settings} open
xywh {382 218 591 513} type Double
code0 {\#include "DetailConfigTable.h"}
class Fl_Window visible
} {
Fl_Return_Button {} {
label Dismiss
callback {table->EndEditing();
hide();}
xywh {480 475 100 25}
}
Fl_Table table {open
xywh {10 35 570 430}
class DetailConfigTable
} {}
Function {onFilterChange()} {open
} {}
Fl_Input inputFilter {
label {Filter:}
callback {onFilterChange();}
xywh {50 11 530 24} when 1
}
}

View File

@ -1,29 +0,0 @@
// generated by Fast Light User Interface Designer (fluid) version 1.0302
#ifndef DetailConfigWindow_h
#define DetailConfigWindow_h
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include "DetailConfigTable.h"
#include <FL/Fl_Return_Button.H>
#include <FL/Fl_Input.H>
class DetailConfigWindow : public Fl_Window {
void _DetailConfigWindow();
public:
DetailConfigWindow(int X, int Y, int W, int H, const char *L = 0);
DetailConfigWindow(int W, int H, const char *L = 0);
DetailConfigWindow();
private:
inline void cb_Dismiss_i(Fl_Return_Button*, void*);
static void cb_Dismiss(Fl_Return_Button*, void*);
public:
DetailConfigTable *table;
Fl_Input *inputFilter;
private:
inline void cb_inputFilter_i(Fl_Input*, void*);
static void cb_inputFilter(Fl_Input*, void*);
public:
void onFilterChange();
};
#endif

View File

@ -1,29 +0,0 @@
/*
Copyright (c) 2013 yvt
This file is part of OpenSpades.
OpenSpades 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 3 of the License, or
(at your option) any later version.
OpenSpades 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.
You should have received a copy of the GNU General Public License
along with OpenSpades. If not, see <http://www.gnu.org/licenses/>.
*/
#include "DetailConfigWindow.h"
#include "../Core/Settings.h"
#include <vector>
#include <string>
void DetailConfigWindow::onFilterChange()
{
table->setFilter( inputFilter->value() );
}

View File

@ -1,63 +0,0 @@
// generated by Fast Light User Interface Designer (fluid) version 1.0302
#include "ErrorDialog.h"
void ErrorDialog::cb_Quit_i(Fl_Return_Button*, void*) {
this->result = 1;
hide();
}
void ErrorDialog::cb_Quit(Fl_Return_Button* o, void* v) {
((ErrorDialog*)(o->parent()))->cb_Quit_i(o,v);
}
void ErrorDialog::cb_Quit1_i(Fl_Button*, void*) {
this->result = 0;
hide();
}
void ErrorDialog::cb_Quit1(Fl_Button* o, void* v) {
((ErrorDialog*)(o->parent()))->cb_Quit1_i(o,v);
}
ErrorDialog::ErrorDialog(int X, int Y, int W, int H, const char *L)
: Fl_Window(X, Y, W, H, L) {
_ErrorDialog();
}
ErrorDialog::ErrorDialog(int W, int H, const char *L)
: Fl_Window(0, 0, W, H, L) {
clear_flag(16);
_ErrorDialog();
}
ErrorDialog::ErrorDialog()
: Fl_Window(0, 0, 595, 171, "OpenSpades Error") {
clear_flag(16);
_ErrorDialog();
}
void ErrorDialog::_ErrorDialog() {
this->box(FL_FLAT_BOX);
this->color(FL_BACKGROUND_COLOR);
this->selection_color(FL_BACKGROUND_COLOR);
this->labeltype(FL_NO_LABEL);
this->labelfont(0);
this->labelsize(14);
this->labelcolor(FL_FOREGROUND_COLOR);
this->align(Fl_Align(FL_ALIGN_CLIP|FL_ALIGN_INSIDE));
this->when(FL_WHEN_RELEASE);
{ infoView = new Fl_Text_Display(25, 40, 550, 70, "An error caused OpenSpades to stop working:");
infoView->align(Fl_Align(FL_ALIGN_TOP_LEFT));
} // Fl_Text_Display* infoView
{ Fl_Return_Button* o = new Fl_Return_Button(475, 125, 100, 25, "Quit");
o->callback((Fl_Callback*)cb_Quit);
} // Fl_Return_Button* o
{ Fl_Button* o = new Fl_Button(440, 145, 100, 25, "Quit");
o->callback((Fl_Callback*)cb_Quit1);
o->hide();
} // Fl_Button* o
{ helpView = new Fl_Output(25, 125, 330, 25);
helpView->box(FL_FLAT_BOX);
helpView->color(FL_BACKGROUND_COLOR);
helpView->textsize(12);
} // Fl_Output* helpView
end();
}

View File

@ -1,31 +0,0 @@
# data file for the Fltk User Interface Designer (fluid)
version 1.0302
header_name {.h}
code_name {.cpp}
widget_class ErrorDialog {
label {OpenSpades Error} open
xywh {166 317 595 171} type Double align 80
class Fl_Window visible
} {
Fl_Text_Display infoView {
label {An error caused OpenSpades to stop working:}
xywh {25 40 550 70} align 5
}
Fl_Return_Button {} {
label Quit
callback {this->result = 1;
hide();} selected
xywh {475 125 100 25}
}
Fl_Button {} {
label Quit
callback {this->result = 0;
hide();}
xywh {440 145 100 25} hide
}
decl {int result;} {public local
}
Fl_Output helpView {
xywh {25 125 330 25} box FLAT_BOX color 49 textsize 12
}
}

View File

@ -1,28 +0,0 @@
// generated by Fast Light User Interface Designer (fluid) version 1.0302
#ifndef ErrorDialog_h
#define ErrorDialog_h
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Text_Display.H>
#include <FL/Fl_Return_Button.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Output.H>
class ErrorDialog : public Fl_Window {
void _ErrorDialog();
public:
ErrorDialog(int X, int Y, int W, int H, const char *L = 0);
ErrorDialog(int W, int H, const char *L = 0);
ErrorDialog();
Fl_Text_Display *infoView;
private:
inline void cb_Quit_i(Fl_Return_Button*, void*);
static void cb_Quit(Fl_Return_Button*, void*);
inline void cb_Quit1_i(Fl_Button*, void*);
static void cb_Quit1(Fl_Button*, void*);
public:
int result;
Fl_Output *helpView;
};
#endif

View File

@ -21,7 +21,6 @@
#include <OpenSpades.h>
#include <Imports/SDL.h>
#include "Main.h"
#include "MainWindow.h"
#include "MainScreen.h"
#include <Core/FileManager.h>
#include <Core/DirectoryFileSystem.h>
@ -31,7 +30,6 @@
#include <Core/Thread.h>
#include <Core/ZipFileSystem.h>
#include <Core/ServerAddress.h>
#include "ErrorDialog.h"
#include "Runner.h"
#include <Client/GameMap.h>
#include <Client/Client.h>
@ -45,6 +43,7 @@
#include <ScriptBindings/ScriptManager.h>
#include <algorithm> //std::sort
#include <FL/Fl.H>
SPADES_SETTING(cl_showStartupWindow, "");
@ -136,17 +135,6 @@ class ThreadQuantumSetter {
#endif
//fltk
void setWindowIcon( Fl_Window* window )
{
#ifdef _WIN32
window->icon( (char *)LoadIconA( GetModuleHandle(NULL), "AppIcon" ) );
#else
//check for mac / linux icon with fltk?
// yvt: no window icon on os x.
#endif
}
#ifdef __APPLE__
#include <xmmintrin.h>
#endif
@ -228,8 +216,6 @@ int main(int argc, char ** argv)
#endif
try{
Fl::scheme("gtk+");
spades::reflection::Backtrace::StartBacktrace();
SPADES_MARK_FUNCTION();
@ -374,30 +360,10 @@ int main(int argc, char ** argv)
SPLog("Initializing window system");
int dum = 0;
Fl::args( argc, argv, dum, argsHandler );
// MAPGEN
/*spades::client::GameMap *m = spades::client::GameMap::Load(spades::FileManager::OpenForReading("Maps/shot0000.vxl"));
for(int x = 0; x < 512; x++) {
for(int y = 0; y < 512; y++) {
for(int z = 0; z < 64; z++) {
if(m->IsSolid(x, y, z)) {
uint32_t col = m->GetColor(x, y, z);
int bri = (col & 0xff) + ((col >> 8) & 0xff) + ((col >> 16) & 0xff);
bri /= 3;
col = 0xff000000 + bri * 0x010101;
m->Set(x, y, z, true, col);
}
}
}
}
auto outs = spades::FileManager::OpenForWriting("Maps/Title.vxl");
m->Save(outs);
delete outs;
return 0;*/
ThreadQuantumSetter quantumSetter;
(void)quantumSetter; // suppress "unused variable" warning
MainWindow* win = NULL;
if( !cg_autoConnect ) {
if(!((int)cl_showStartupWindow != 0 ||
Fl::get_key(FL_Shift_L) || Fl::get_key(FL_Shift_R))) {
@ -408,17 +374,6 @@ int main(int argc, char ** argv)
}else{
SPLog("Starting startup window");
::spades::gui::StartupScreen::Run();
/*
SPLog("Initializing main window");
win = new MainWindow();
win->Init();
setWindowIcon( win );
win->show(argc, argv);
win->CheckGLCapability();
SPLog("Entering FLTK main loop");
Fl::run();
SPLog("Leaving FLTK main loop");*/
}
} else {
spades::ServerAddress host(cg_lastQuickConnectHost.CString(), (int)cg_protocolVersion == 3 ? spades::ProtocolVersion::v075 : spades::ProtocolVersion::v076 );
@ -426,27 +381,18 @@ int main(int argc, char ** argv)
}
spades::Settings::GetInstance()->Flush();
if( win ) {
delete win;
}
}catch(const std::exception& ex) {
ErrorDialog dlg;
setWindowIcon( &dlg );
dlg.set_modal();
dlg.result = 0;
std::string msg = ex.what();
msg = _Tr("Main", "A serious error caused OpenSpades to stop working:\n\n{0}\n\nSee SystemMessages.log for more details.", msg);
// TODO: free this buffer (just leaking)
Fl_Text_Buffer *buf = new Fl_Text_Buffer;
buf->append(ex.what());
dlg.infoView->wrap_mode(Fl_Text_Display::WRAP_AT_BOUNDS, 0);
dlg.infoView->buffer(buf);
dlg.helpView->value("See SystemMessages.log for more details.");
dlg.show();
while(dlg.visible()){
Fl::wait();
SPLog("[!] Terminating due to the fatal error: %s", ex.what());
SDL_InitSubSystem(SDL_INIT_VIDEO);
if(SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, _Tr("Main", "OpenSpades Fatal Error").c_str(), msg.c_str(), nullptr)) {
// showing dialog failed.
// TODO: do appropriate action
}
}

View File

@ -1,314 +0,0 @@
# data file for the Fltk User Interface Designer (fluid)
version 1.0302
header_name {.h}
code_name {.cpp}
decl {namespace spades { class Serverbrowser; class ServerAddress; }} {public global
}
widget_class MainWindow {
label {OpenSpades Startup} open
xywh {426 303 616 357} type Double labelsize 12 align 80
code0 {\#include <string>}
code1 {\#include <vector>}
class Fl_Window visible
} {
Fl_Group quickConnectGroup {open
private xywh {105 80 500 25} hide
} {
Fl_Input quickHostInput {
label {Quick Connect:}
callback {SavePrefs();}
private xywh {105 80 275 25}
}
Fl_Choice versionChoice {
label Version
callback {versionSelectionChanged();} open
xywh {440 80 60 25} down_box BORDER_BOX
} {}
Fl_Return_Button connectButton {
label Connect
callback {QuickConnectPressed();}
private xywh {505 80 100 25}
}
}
Fl_Group launchMainScreenGroup {open
private xywh {5 80 605 25}
} {
Fl_Return_Button startButton {
label {Start Game}
callback {StartGamePressed();}
xywh {475 80 135 25}
}
Fl_Check_Button bypassStartupCheck {
label {Bypass this startup screen the next time OpenSpades starts}
callback {SavePrefs();}
private xywh {5 80 465 25} down_box DOWN_BOX
}
}
Fl_Tabs mainTab {open
private xywh {5 110 605 240} labelsize 11
} {
Fl_Group groupAbout {
label About open
xywh {10 130 595 215} hide
} {
Fl_Help_View aboutView {
xywh {10 135 595 210}
}
}
Fl_Group {} {
label Setup open
private xywh {10 130 595 220}
} {
Fl_Group {} {
label Video open
private xywh {10 150 385 70} box ENGRAVED_FRAME align 5
} {
Fl_Check_Button fullscreenCheck {
label {Full Screen}
callback {SavePrefs();}
private xywh {20 190 100 25} down_box DOWN_BOX
}
Fl_Input_Choice modeSelect {
label Mode
callback {SavePrefs();} open
private xywh {65 160 160 25} when 1
} {}
Fl_Check_Button verticalSyncCheck {
label {Vertical Sync}
callback {SavePrefs();}
xywh {150 190 110 25} down_box DOWN_BOX
}
Fl_Choice rendererSelect {
callback {SavePrefs();} open
xywh {235 160 150 25} down_box BORDER_BOX
} {}
}
Fl_Group {} {
label Audio open
private xywh {400 150 205 80} box ENGRAVED_FRAME align 5
} {
Fl_Spinner polyInput {
label {Max Polyphonics:}
callback {SavePrefs();}
private xywh {545 195 50 25} when 1
}
Fl_Choice audioSelect {
callback {SavePrefs();} open
xywh {410 160 185 25} down_box BORDER_BOX
} {}
}
Fl_Group glRendererGroup {
label Graphics open
private xywh {10 240 385 105} box ENGRAVED_FRAME align 5
} {
Fl_Light_Button radiosityCheck {
label {Global Illumination}
callback {SavePrefs();}
xywh {20 310 170 25} when 1
}
Fl_Choice directLightSelect {
label Lighting
callback {if(directLightSelect->value() == 2)
DisableMSAA();
SavePrefs();} open
xywh {265 280 120 25} down_box BORDER_BOX when 1
} {}
Fl_Choice shaderSelect {
label {Shader FX}
callback {if(shaderSelect->value() == 1)
DisableMSAA();
SavePrefs();} open
xywh {265 310 120 25} down_box BORDER_BOX when 1
} {}
Fl_Light_Button bloodCheck {
label Blood
callback {SavePrefs();}
xywh {20 310 100 25} when 1 hide
}
Fl_Choice postFilterSelect {
label {Post FX}
callback {SavePrefs();} open
xywh {265 250 120 25} down_box BORDER_BOX
} {}
Fl_Choice particleSelect {
label Particle
callback {SavePrefs();} open
xywh {90 280 100 25} down_box BORDER_BOX
} {}
Fl_Choice msaaSelect {
label {AA:}
callback {MSAAEnabled();
SavePrefs();} open
private xywh {90 250 100 25} down_box BORDER_BOX when 1
} {}
}
Fl_Group {} {
label {Game Options} open
private xywh {400 150 205 70} box ENGRAVED_FRAME align 5 hide
} {
Fl_Input playerNameInput {
label {Player Name:}
callback {SavePrefs();}
private xywh {410 175 185 25} align 5 when 1
}
}
Fl_Button {} {
label {Advanced Settings...}
callback {OpenDetailConfig();}
xywh {415 305 170 25}
}
Fl_Group swRendererGroup {
label Graphics open
xywh {10 240 385 105} box ENGRAVED_BOX align 5
} {
Fl_Choice fastModeSelect {
label {Fast Mode}
callback {SavePrefs();} open
xywh {120 255 125 25} down_box BORDER_BOX
} {}
}
}
Fl_Group groupReport {
label {System Report} open
xywh {10 130 595 220} hide
} {
Fl_Group {} {
label Graphics open
xywh {10 150 595 195} box ENGRAVED_FRAME align 5
} {
Fl_Output outputGLRenderer {
label {OpenGL Renderer}
xywh {145 160 455 20} labelsize 12 textsize 12
}
Fl_Output outputGLVersion {
label {OpenGL Version}
xywh {145 185 455 20} labelsize 12 textsize 12
}
Fl_Output outputGLSLVersion {
label {GLSL Version}
xywh {145 210 455 20} labelsize 12 textsize 12
}
Fl_Help_View glInfoView {
label {OpenGL Extensions}
xywh {145 235 455 105} labelsize 12 align 7
}
}
}
Fl_Tabs groupServerlist {
label Serverlist open
xywh {10 130 595 220} hide
} {
Fl_Browser serverListbox {
label Serverlist
callback {ServerSelectionChanged();}
protected xywh {10 150 595 200} type Hold
}
Fl_Group {} {
label Filters
xywh {10 150 595 200} hide
} {
Fl_Group {} {
label Players open
xywh {20 175 80 35}
} {
Fl_Check_Button checkFilterEmpty {
label Empty
callback {updateFilters();}
xywh {20 175 80 15} down_box DOWN_BOX value 1 when 1
}
Fl_Check_Button checkFilterFull {
label Full
callback {updateFilters();}
xywh {20 195 80 15} down_box DOWN_BOX value 1 when 1
}
}
Fl_Group {} {
label Version open
xywh {95 175 104 60}
} {
Fl_Check_Button checkFilterV75 {
label {0.75}
callback {updateFilters();}
xywh {100 175 80 15} down_box DOWN_BOX value 1 when 1
}
Fl_Check_Button checkFilterV76 {
label {0.76}
callback {updateFilters();}
xywh {100 190 80 25} down_box DOWN_BOX value 1 when 1
}
Fl_Check_Button checkFilterVOther {
label Other
callback {updateFilters();}
xywh {100 205 64 30} down_box DOWN_BOX value 1 when 1
}
}
}
Fl_Group {} {
label Misc open
xywh {10 150 595 200} hide
} {
Fl_Button {} {
label {Connect local v0.75}
callback {connectLocal075Pressed();}
xywh {20 165 140 30}
}
Fl_Button {} {
label {Connect local v0.76}
callback {connectLocal076Pressed();}
xywh {20 200 140 30}
}
}
}
}
Fl_Box bannerBox {
private xywh {5 5 605 70} box THIN_DOWN_FRAME
}
Function {QuickConnectPressed()} {open private
} {}
Function {LoadPrefs()} {open
} {}
Function {SavePrefs()} {open private
} {}
decl {bool inited;} {private local
}
code {inited = false;} {}
code {browser = 0;} {}
Function {OpenDetailConfig()} {open private
} {}
Function {Init()} {open
} {}
Function {DisableMSAA()} {open private return_type void
} {}
Function {MSAAEnabled()} {open private return_type void
} {}
Function {CheckGLCapability()} {open return_type void
} {}
Function {ServerSelectionChanged()} {open private
} {}
decl {spades::Serverbrowser* browser;} {protected local
}
Function {updateFilters();} {open return_type void
} {}
Function {~MainWindow()} {open
} {}
decl {bool shaderHighCapable;} {private local
}
decl {bool postFilterHighCapable;} {private local
}
decl {bool particleHighCapable;} {private local
}
Function {connectLocal075Pressed()} {open protected
} {}
Function {connectLocal076Pressed()} {open protected
} {}
Function {versionSelectionChanged()} {open
} {}
Function {StartGamePressed()} {open private return_type void
} {}
decl {bool glCapable;} {selected private local
}
}
data aboutText {public local filename {AboutText.html}
}

View File

@ -22,9 +22,9 @@
#include "View.h"
#include "SDLRunner.h"
#include "SDLAsyncRunner.h"
#include "ErrorDialog.h"
#include <Core/Settings.h>
#include <Core/Exception.h>
#include <Core/Strings.h>
SPADES_SETTING(cg_smp, "0");
SPADES_SETTING(r_videoWidth, "1024");
@ -51,26 +51,24 @@ namespace spades {
Run();
}catch(const spades::Exception& ex){
err = ex.GetShortMessage();
SPLog("Unhandled exception in SDLRunner:\n%s", ex.what());
SPLog("[!] Unhandled exception in SDLRunner:\n%s", ex.what());
}catch(const std::exception& ex){
err = ex.what();
SPLog("Unhandled exception in SDLRunner:\n%s", ex.what());
SPLog("[!] Unhandled exception in SDLRunner:\n%s", ex.what());
}
if(!err.empty()){
ErrorDialog dlg;
dlg.set_modal();
dlg.result = 0;
// TODO: free this buffer (just leaking)
Fl_Text_Buffer *buf = new Fl_Text_Buffer;
buf->append(err.c_str());
dlg.infoView->wrap_mode(Fl_Text_Display::WRAP_AT_BOUNDS, 0);
dlg.infoView->buffer(buf);
dlg.helpView->value("See SystemMessages.log for more details.");
dlg.show();
while(dlg.visible()){
Fl::wait();
std::string msg = err;
msg = _Tr("Main", "A serious error caused OpenSpades to stop working:\n\n{0}\n\nSee SystemMessages.log for more details.", msg);
SDL_InitSubSystem(SDL_INIT_VIDEO);
if(SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, _Tr("Main", "OpenSpades Fatal Error").c_str(), msg.c_str(), nullptr)) {
// showing dialog failed.
// TODO: do appropriate action
}
}
}
void Runner::Run() {