aboutsummaryrefslogtreecommitdiffstats
path: root/finance
diff options
context:
space:
mode:
authorgahr <gahr@FreeBSD.org>2011-11-15 20:54:11 +0800
committergahr <gahr@FreeBSD.org>2011-11-15 20:54:11 +0800
commit434262d99ae319bfb60a06ccb5d7b6ceb0ab58e5 (patch)
treed98358d44417cf85dff99835f0a8402e12f0043e /finance
parentf044119495cc2ab0a6c26fede95a88a5e86cdd03 (diff)
downloadfreebsd-ports-graphics-434262d99ae319bfb60a06ccb5d7b6ceb0ab58e5.tar.gz
freebsd-ports-graphics-434262d99ae319bfb60a06ccb5d7b6ceb0ab58e5.tar.zst
freebsd-ports-graphics-434262d99ae319bfb60a06ccb5d7b6ceb0ab58e5.zip
- Unbreak - fix build with latest x11-toolkits/fltk
Feature safe: yes
Diffstat (limited to 'finance')
-rw-r--r--finance/xtrader/Makefile4
-rw-r--r--finance/xtrader/files/patch-Makefile.linux4
-rw-r--r--finance/xtrader/files/patch-util_fl_Fl_Table.cpp56
-rw-r--r--finance/xtrader/files/patch-util_fl_Fl_Table.h26
-rw-r--r--finance/xtrader/files/patch-xtrader_src_dlg_DownloadDlg.cpp40
-rw-r--r--finance/xtrader/files/patch-xtrader_src_dlg_DownloadDlg.h19
-rw-r--r--finance/xtrader/files/patch-xtrader_src_dlg_ExportDlg.cpp41
-rw-r--r--finance/xtrader/files/patch-xtrader_src_dlg_ExportDlg.h19
-rw-r--r--finance/xtrader/files/patch-xtrader_src_gui_ReportView.cpp51
-rw-r--r--finance/xtrader/files/patch-xtrader_src_gui_XTrader.cpp87
10 files changed, 343 insertions, 4 deletions
diff --git a/finance/xtrader/Makefile b/finance/xtrader/Makefile
index de96e273a9d..0e34f2ac7f2 100644
--- a/finance/xtrader/Makefile
+++ b/finance/xtrader/Makefile
@@ -17,8 +17,6 @@ COMMENT= Technical analysis program for financial instruments
LIB_DEPENDS= ptypes.21:${PORTSDIR}/devel/ptypes \
fltk.1:${PORTSDIR}/x11-toolkits/fltk
-BROKEN= does not compile
-
MAKE_ENV= PTHREAD_LIBS="${PTHREAD_LIBS}"
MAKEFILE= Makefile.linux
USE_XORG= x11 xpm
@@ -38,6 +36,8 @@ post-patch:
${WRKSRC}/xtrader/src/Resource.h
${REINPLACE_CMD} -e 's|int(data)|(unsigned long)data|' \
${WRKSRC}/xtrader/src/gui/XTrader.h
+ ${FIND} ${WRKSRC} -type f -name "*.cpp" -o -name "*.h" | ${XARGS} \
+ ${REINPLACE_CMD} -e '/^#include <FL/s|.h>$$|.H>|; s|fl_file_chooser|Fl_File_Chooser|g'
do-install:
@${MKDIR} ${DATADIR}
diff --git a/finance/xtrader/files/patch-Makefile.linux b/finance/xtrader/files/patch-Makefile.linux
index ef14baccdc3..25fcad4a1e5 100644
--- a/finance/xtrader/files/patch-Makefile.linux
+++ b/finance/xtrader/files/patch-Makefile.linux
@@ -1,5 +1,5 @@
---- xtrader/Makefile.linux.orig Thu Oct 21 18:21:08 2004
-+++ xtrader/Makefile.linux Sat Apr 16 23:40:08 2005
+--- ./xtrader/Makefile.linux.orig 2004-10-22 00:21:08.000000000 +0200
++++ ./xtrader/Makefile.linux 2011-11-15 13:46:18.000000000 +0100
@@ -1,12 +1,12 @@
-COMP= g++
-IFLAGS= -I../util -Isrc -I/usr/local/include -I/usr/include/ptypes
diff --git a/finance/xtrader/files/patch-util_fl_Fl_Table.cpp b/finance/xtrader/files/patch-util_fl_Fl_Table.cpp
new file mode 100644
index 00000000000..c55ec51c0f6
--- /dev/null
+++ b/finance/xtrader/files/patch-util_fl_Fl_Table.cpp
@@ -0,0 +1,56 @@
+--- ./util/fl/Fl_Table.cpp.orig 2004-11-14 11:21:29.000000000 +0100
++++ ./util/fl/Fl_Table.cpp 2011-11-15 13:46:19.000000000 +0100
+@@ -10,15 +10,15 @@
+ #include "Fl_Select.h"
+ #include "Fl_Find.h"
+ #include "Fl_Defines.h"
+-#include <FL/Fl.h>
+-#include <FL/fl_ask.h>
+-#include <FL/fl_draw.h>
+-#include <FL/Fl_Choice.h>
+-#include <FL/Fl_Check_Button.h>
+-#include <FL/Fl_File_Chooser.h>
+-#include <FL/Fl_Input.h>
+-#include <FL/Fl_Scrollbar.h>
+-#include <FL/fl_show_colormap.h>
++#include <FL/Fl.H>
++#include <FL/fl_ask.H>
++#include <FL/fl_draw.H>
++#include <FL/Fl_Choice.H>
++#include <FL/Fl_Check_Button.H>
++#include <FL/Fl_File_Chooser.H>
++#include <FL/Fl_Input.H>
++#include <FL/Fl_Scrollbar.H>
++#include <FL/fl_show_colormap.H>
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <string.h>
+@@ -962,7 +962,14 @@
+ }
+ }
+
+-
++/**
++ * Callback for file chooser
++ */
++void tab_fc_callback(Fl_File_Chooser *fc, void *data)
++{
++ Fl_Table *t = static_cast<Fl_Table *>(data);
++ t->aData->value (fc->value(), t->aCurrRow, t->aCurrCol);
++}
+
+ /**
+ * Start to edit a cell
+@@ -983,9 +990,10 @@
+
+ }
+ else if (aData->editor_type (aCurrRow, aCurrCol, false) == FL_DLG_FILE_EDITOR) {
+- char* file = fl_file_chooser("Select File", "*", aData->value(aCurrRow, aCurrCol));
+- aData->value (file, aCurrRow, aCurrCol);
+
++ Fl_File_Chooser *fc = new Fl_File_Chooser("Select File", "*", Fl_File_Chooser::SINGLE, aData->value(aCurrRow, aCurrCol));
++ fc->callback(tab_fc_callback, this);
++ delete fc;
+ }
+ else {
+ aEditWidget = aData->editor (aCurrRow, aCurrCol, force_custom);
diff --git a/finance/xtrader/files/patch-util_fl_Fl_Table.h b/finance/xtrader/files/patch-util_fl_Fl_Table.h
new file mode 100644
index 00000000000..02db64451ad
--- /dev/null
+++ b/finance/xtrader/files/patch-util_fl_Fl_Table.h
@@ -0,0 +1,26 @@
+--- ./util/fl/Fl_Table.h.orig 2004-11-14 11:21:34.000000000 +0100
++++ ./util/fl/Fl_Table.h 2011-11-15 13:46:19.000000000 +0100
+@@ -12,12 +12,13 @@
+ #define snprintf _snprintf
+ #endif
+
+-#include <FL/Fl_Group.h>
++#include <FL/Fl_Group.H>
+ #include "Fl_Table_Data.h"
+
+ class Fl_Input;
+ class Fl_Scrollbar;
+ class Fl_Find;
++class Fl_File_Chooser;
+
+ enum {
+ FL_DATA_CHANGE = 1000,
+@@ -121,6 +122,8 @@
+ void get_cell_pos (int& row, int& col, int& xpos, int& ypos, int& width, int& height);
+ void start_edit_mode (bool force = false);
+ void set_cursor(int row, int col) {move_cursor (row - aCurrRow, col - aCurrCol);}
++ friend void tab_fc_callback(Fl_File_Chooser *fc, void *data);
++
+ };
+
+ #endif
diff --git a/finance/xtrader/files/patch-xtrader_src_dlg_DownloadDlg.cpp b/finance/xtrader/files/patch-xtrader_src_dlg_DownloadDlg.cpp
new file mode 100644
index 00000000000..66b6221ea40
--- /dev/null
+++ b/finance/xtrader/files/patch-xtrader_src_dlg_DownloadDlg.cpp
@@ -0,0 +1,40 @@
+--- ./xtrader/src/dlg/DownloadDlg.cpp.orig 2004-11-14 11:21:30.000000000 +0100
++++ ./xtrader/src/dlg/DownloadDlg.cpp 2011-11-15 13:46:19.000000000 +0100
+@@ -21,8 +21,8 @@
+ #include "Enums.h"
+ #include "Progress.h"
+ #include "Resource.h"
+-#include <FL/fl_ask.h>
+-#include <FL/Fl_File_Chooser.h>
++#include <FL/fl_ask.H>
++#include <FL/Fl_File_Chooser.H>
+ #include <MHDate.h>
+ #include <MHDebug.h>
+ #include <MHFile.h>
+@@ -164,13 +164,24 @@
+ }
+
+
++/**
++ * Callback for file chooser
++ */
++void dlg_fc_callback(Fl_File_Chooser *fc, void *data)
++{
++ DownloadDlg *d = static_cast<DownloadDlg *>(data);
++ const char *file = fc->value();
++ if (file && *file) d->aFile->value(file);
++
++}
+
+ /**
+ * Browse for result file name
+ */
+ void DownloadDlg::cb3 () {
+- char* file = fl_file_chooser (STRING(DLG_SELECT_WRITE_FILE), "*.*", "");
+- if (file && *file) aFile->value (file);
++ Fl_File_Chooser *fc = new Fl_File_Chooser (STRING(DLG_SELECT_WRITE_FILE), "*.*", Fl_File_Chooser::SINGLE, "");
++ fc->callback(dlg_fc_callback, this);
++ delete fc;
+ }
+
+
diff --git a/finance/xtrader/files/patch-xtrader_src_dlg_DownloadDlg.h b/finance/xtrader/files/patch-xtrader_src_dlg_DownloadDlg.h
new file mode 100644
index 00000000000..38ec0f85621
--- /dev/null
+++ b/finance/xtrader/files/patch-xtrader_src_dlg_DownloadDlg.h
@@ -0,0 +1,19 @@
+--- ./xtrader/src/dlg/DownloadDlg.h.orig 2004-11-14 11:21:35.000000000 +0100
++++ ./xtrader/src/dlg/DownloadDlg.h 2011-11-15 13:46:19.000000000 +0100
+@@ -18,6 +18,7 @@
+ #include <download/BaseDownload.h>
+
+ class Report;
++class Fl_File_Chooser;
+
+
+
+@@ -51,6 +52,8 @@
+ Fl_Button* aClose;
+
+ void download (int type, const char* start, const char* stop, int action);
++
++ friend void dlg_fc_callback(Fl_File_Chooser *fc, void *data);
+ };
+
+ #endif
diff --git a/finance/xtrader/files/patch-xtrader_src_dlg_ExportDlg.cpp b/finance/xtrader/files/patch-xtrader_src_dlg_ExportDlg.cpp
new file mode 100644
index 00000000000..d949b682b6b
--- /dev/null
+++ b/finance/xtrader/files/patch-xtrader_src_dlg_ExportDlg.cpp
@@ -0,0 +1,41 @@
+--- ./xtrader/src/dlg/ExportDlg.cpp.orig 2004-11-14 11:21:29.000000000 +0100
++++ ./xtrader/src/dlg/ExportDlg.cpp 2011-11-15 13:46:19.000000000 +0100
+@@ -14,9 +14,9 @@
+ #include <help/Export.h>
+ #include <MHDate.h>
+ #include <MHDebug.h>
+-#include <FL/fl_draw.h>
+-#include <FL/fl_ask.h>
+-#include <FL/Fl_File_Chooser.h>
++#include <FL/fl_draw.H>
++#include <FL/fl_ask.H>
++#include <FL/Fl_File_Chooser.H>
+
+
+
+@@ -134,13 +134,23 @@
+ }
+
+
++/**
++ * Callback for file chooser
++ */
++void exp_fc_callback(Fl_File_Chooser *fc, void *data)
++{
++ ExportDlg *e = static_cast<ExportDlg *>(data);
++ const char *file = fc->value();
++ if (file && *file) e->aFile->value(file);
++}
+
+ /**
+ * Get filename
+ */
+ void ExportDlg::cb3 () {
+- char* file = fl_file_chooser (STRING(DLG_SELECT_WRITE_FILE), "*.*", "");
+- if (file && *file) aFile->value (file);
++ Fl_File_Chooser *fc = new Fl_File_Chooser(STRING(DLG_SELECT_WRITE_FILE), "*.*", Fl_File_Chooser::SINGLE, "");
++ fc->callback(exp_fc_callback, this);
++ delete fc;
+ }
+
+
diff --git a/finance/xtrader/files/patch-xtrader_src_dlg_ExportDlg.h b/finance/xtrader/files/patch-xtrader_src_dlg_ExportDlg.h
new file mode 100644
index 00000000000..caebcd37668
--- /dev/null
+++ b/finance/xtrader/files/patch-xtrader_src_dlg_ExportDlg.h
@@ -0,0 +1,19 @@
+--- ./xtrader/src/dlg/ExportDlg.h.orig 2004-11-14 11:21:35.000000000 +0100
++++ ./xtrader/src/dlg/ExportDlg.h 2011-11-15 13:46:19.000000000 +0100
+@@ -16,6 +16,7 @@
+ #include <FL/Fl_Button.H>
+
+ class Report;
++class Fl_File_Chooser;
+
+
+
+@@ -45,6 +46,8 @@
+ Fl_Button* aBrowse;
+ Fl_Button* aHelp;
+ Fl_Button* aClose;
++
++ friend void exp_fc_callback(Fl_File_Chooser *fc, void *data);
+ };
+
+ #endif
diff --git a/finance/xtrader/files/patch-xtrader_src_gui_ReportView.cpp b/finance/xtrader/files/patch-xtrader_src_gui_ReportView.cpp
new file mode 100644
index 00000000000..9edaf9db334
--- /dev/null
+++ b/finance/xtrader/files/patch-xtrader_src_gui_ReportView.cpp
@@ -0,0 +1,51 @@
+--- ./xtrader/src/gui/ReportView.cpp.orig 2004-11-14 11:21:30.000000000 +0100
++++ ./xtrader/src/gui/ReportView.cpp 2011-11-15 13:46:19.000000000 +0100
+@@ -21,13 +21,13 @@
+ #include "Resource.h"
+ #include <MHDate.h>
+ #include <MHVector.h>
+-#include <FL/Fl.h>
+-#include <FL/fl_ask.h>
+-#include <FL/fl_draw.h>
+-#include <FL/Fl_Button.h>
+-#include <FL/Fl_File_Chooser.h>
++#include <FL/Fl.H>
++#include <FL/fl_ask.H>
++#include <FL/fl_draw.H>
++#include <FL/Fl_Button.H>
++#include <FL/Fl_File_Chooser.H>
+ #include <fl/Fl_Layout.h>
+-#include <FL/Fl_Hold_Browser.h>
++#include <FL/Fl_Hold_Browser.H>
+ #include <fl/Fl_Table.h>
+ #include <fl/Fl_Table_Data.h>
+
+@@ -139,7 +139,15 @@
+ void ReportView::cbBrowser2 () {
+ }
+
+-
++/**
++ * Callback for file chooser
++ */
++void rep_fc_callback(Fl_File_Chooser *fc, void *data)
++{
++ Report *r = static_cast<Report *>(data);
++ const char *file = fc->value();
++ if (file && *file) r->Save (file);
++}
+
+ /**
+ * Callback for buttons
+@@ -173,8 +181,9 @@
+ Report* r = ((ReportData*)aTable->data())->report();
+
+ if (r) {
+- char* file = fl_file_chooser (STRING(DLG_SELECT_WRITE_FILE), "*.*", "");
+- if (file && *file) r->Save (file);
++ Fl_File_Chooser *fc = new Fl_File_Chooser (STRING(DLG_SELECT_WRITE_FILE), "*.*", Fl_File_Chooser::SINGLE, "");
++ fc->callback(rep_fc_callback, r);
++ delete fc;
+ }
+ }
+ else if (strcmp (button->label(), STRING(SELECT2)) == 0) {
diff --git a/finance/xtrader/files/patch-xtrader_src_gui_XTrader.cpp b/finance/xtrader/files/patch-xtrader_src_gui_XTrader.cpp
new file mode 100644
index 00000000000..ec1e442b9e2
--- /dev/null
+++ b/finance/xtrader/files/patch-xtrader_src_gui_XTrader.cpp
@@ -0,0 +1,87 @@
+--- ./xtrader/src/gui/XTrader.cpp.orig 2004-11-14 11:21:30.000000000 +0100
++++ ./xtrader/src/gui/XTrader.cpp 2011-11-15 13:46:19.000000000 +0100
+@@ -34,11 +34,11 @@
+ #include "table/SecurityData.h"
+ #include "table/SetData.h"
+ #include "table/SetItemData.h"
+-#include <FL/Fl.h>
+-#include <FL/Fl_Box.h>
+-#include <FL/fl_file_chooser.h>
++#include <FL/Fl.H>
++#include <FL/Fl_Box.H>
++#include <FL/Fl_File_Chooser.H>
+ #include <fl/Fl_Layout.h>
+-#include <FL/Fl_Menu_Bar.h>
++#include <FL/Fl_Menu_Bar.H>
+ #include <fl/Fl_Table_Data.h>
+ #include <MHDate.h>
+ #include <MHDebug.h>
+@@ -249,6 +249,34 @@
+ }
+
+
++/**
++ * Callback for file chooser
++ */
++void fc_callback(Fl_File_Chooser *fc, void *data)
++{
++ XTrader *xt = static_cast<XTrader *>(data);
++ const char *file = fc->value();
++
++ if (file && *file) {
++ MHDate date;
++ Import* import = 0;
++ double start = MHUtil::Time();
++
++ XTrader::StartWork (STRING(INFO_IMPORTING));
++ try {
++ import = new Import (file);
++ import->Read ();
++ char buffer[100];
++ snprintf (buffer, 99, "%s (%d %s / %.1fs) (%s=%d)", STRING(INFO_IMPORT_FINISHED), import->Rows(), STRING(ROWS), MHUtil::Time() - start, STRING(ERROR_), import->Errors());
++ XTrader::SetMessage (buffer);
++ }
++ catch (const char* message) {
++ XTrader::SetError (message);
++ }
++ XTrader::StopWork ("");
++ delete import;
++ }
++}
+
+ /**
+ * Callback for all menu items
+@@ -291,28 +319,11 @@
+ break;
+
+ case Resource::MENU_IMPORT: {
+- char* file = fl_file_chooser (STRING(DLG_IMPORT), STRING(DLG_IMPORT_FILTER), "");
+- if (file && *file) {
+- MHDate date;
+- Import* import = 0;
+- double start = MHUtil::Time();
+-
+- XTrader::StartWork (STRING(INFO_IMPORTING));
+- try {
+- import = new Import (file);
+- import->Read ();
+- char buffer[100];
+- snprintf (buffer, 99, "%s (%d %s / %.1fs) (%s=%d)", STRING(INFO_IMPORT_FINISHED), import->Rows(), STRING(ROWS), MHUtil::Time() - start, STRING(ERROR_), import->Errors());
+- XTrader::SetMessage (buffer);
+- }
+- catch (const char* message) {
+- XTrader::SetError (message);
+- }
+- XTrader::StopWork ("");
+- delete import;
+- aListeners->Send (0, "Import", "changed", 0, 0);
+- Fl::redraw ();
+- }
++ Fl_File_Chooser *fc = new Fl_File_Chooser (STRING(DLG_IMPORT), STRING(DLG_IMPORT_FILTER), Fl_File_Chooser::SINGLE, "");
++ fc->callback(fc_callback);
++ delete fc;
++ aListeners->Send (0, "Import", "changed", 0, 0);
++ Fl::redraw ();
+ break;
+ }
+