r3227 - software/ui/src
Miriam Ruiz
baby-guest at alioth.debian.org
Wed Jul 4 09:16:36 UTC 2007
Author: baby-guest
Date: 2007-07-04 09:16:36 +0000 (Wed, 04 Jul 2007)
New Revision: 3227
Modified:
software/ui/src/pkgbrowser.cpp
software/ui/src/pkgbrowser.h
software/ui/src/ui.fld
Log:
Show package description in an HTML View window
Modified: software/ui/src/pkgbrowser.cpp
===================================================================
--- software/ui/src/pkgbrowser.cpp 2007-07-04 08:52:59 UTC (rev 3226)
+++ software/ui/src/pkgbrowser.cpp 2007-07-04 09:16:36 UTC (rev 3227)
@@ -118,13 +118,13 @@
char *pkg_txt = new char[4096];
if (ui)
{
- Fl_Text_Buffer *buffer = ui->InfoBuffer();
- snprintf(pkg_txt, 4096, "Package: %s\n", rec.package().c_str());
- buffer->text(pkg_txt);
- snprintf(pkg_txt, 4096, "Description: %s\n", rec.shortDescription().c_str());
- buffer->append(pkg_txt);
- snprintf(pkg_txt, 4096, "\n%s\n", rec.longDescription().c_str());
- buffer->append(pkg_txt);
+ snprintf(pkg_txt, 4096, "<center><h1><a href=\"pkg:%s\">%s</a></h1></center><br /><center>%s</center><hr /><p>%s</p>",
+ rec.package().c_str(),
+ rec.package().c_str(),
+ rec.shortDescription().c_str(),
+ rec.longDescription().c_str()
+ );
+ ui->InfoView->value(pkg_txt);
}
delete [] pkg_txt;
@@ -203,3 +203,14 @@
}
return ret;
}
+
+PackageView::PackageView(int xx, int yy, int ww, int hh, const char *l) : Fl_Help_View(xx, yy, ww, hh, l)
+{
+ link(PackageView::link_cb);
+}
+
+const char *PackageView::link_cb(Fl_Widget *w, const char *uri)
+{
+ printf("PackageView::link_cb(): Widget=0x%lX, URI=\"%s\"\n", (unsigned long)w, uri);
+ return NULL;
+}
Modified: software/ui/src/pkgbrowser.h
===================================================================
--- software/ui/src/pkgbrowser.h 2007-07-04 08:52:59 UTC (rev 3226)
+++ software/ui/src/pkgbrowser.h 2007-07-04 09:16:36 UTC (rev 3227)
@@ -28,6 +28,7 @@
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Browser.H>
+#include <FL/Fl_Help_View.H>
#include <FL/fl_draw.H>
//
// Demonstrate how to derive a class extending Fl_Browser with interactively resizable columns
@@ -204,4 +205,13 @@
virtual int handle(int e);
};
+class PackageView : public Fl_Help_View
+{
+public:
+ PackageView(int xx, int yy, int ww, int hh, const char *l = 0);
+
+private:
+ static const char *link_cb(Fl_Widget *w, const char *uri);
+};
+
#endif
Modified: software/ui/src/ui.fld
===================================================================
--- software/ui/src/ui.fld 2007-07-04 08:52:59 UTC (rev 3226)
+++ software/ui/src/ui.fld 2007-07-04 09:16:36 UTC (rev 3227)
@@ -18,7 +18,7 @@
} {
Function {GamesUI()} {open
} {
- code {InfoTextBuffer = new Fl_Text_Buffer;} {}
+ code {} {}
}
Function {~GamesUI()} {open
} {
@@ -26,10 +26,8 @@
Fl_Image *i=ScreenshotWidget->image();
ScreenshotWidget->image(NULL);
delete i;
+ }} {}
}
-if (InfoTextBuffer)
- delete InfoTextBuffer;} {}
- }
Function {Resize(int w, int h)} {open return_type void
} {
code {static const int border = 6;
@@ -51,10 +49,11 @@
if (ScreenshotWidget)
ScreenshotWidget->resize(x_ref, border, 320, 240);
-if (InfoText)
- InfoText->resize(x_ref, border + 240 + vgap, 320, h_info);
+if (InfoView)
+ InfoView->resize(x_ref, border + 240 + vgap, 320, h_info);
if (DebTagsBrowser)
- DebTagsBrowser->resize(x_ref, border + 240 + h_info + vgap * 2, 320, h_tags);} {}
+ DebTagsBrowser->resize(x_ref, border + 240 + h_info + vgap * 2, 320, h_tags);} {selected
+ }
}
Function {Screenshot(Fl_Image *img)} {open return_type void
} {
@@ -67,16 +66,10 @@
}
ScreenshotWidget->redraw();} {}
}
- Function {InfoBuffer()} {open return_type {Fl_Text_Buffer *}
- } {
- code {if (!InfoText->buffer())
- InfoText->buffer(InfoTextBuffer);
-return InfoTextBuffer;} {}
- }
Function {CreateMainWindow()} {open
} {
Fl_Window {} {open
- xywh {551 58 710 525} type Single resizable
+ xywh {494 199 710 525} type Single resizable
class MainWindow visible
} {
Fl_Group InputGroup {open
@@ -120,17 +113,17 @@
xywh {5 140 375 375} type Select align 0 textsize 12
class PackageBrowser
}
- Fl_Text_Display InfoText {
- xywh {385 260 320 170} align 0 textsize 12
- }
- Fl_Browser DebTagsBrowser {selected
+ Fl_Browser DebTagsBrowser {
xywh {385 435 320 80} align 0 textsize 11
class VersatileBrowser
}
+ Fl_Help_View InfoView {
+ xywh {385 260 320 170}
+ class PackageView
+ }
}
code {w->size_range(710, 500);} {}
}
decl {Engine *engine;} {public
}
- decl {Fl_Text_Buffer *InfoTextBuffer;} {}
}
More information about the Pkg-games-commits
mailing list