--- /dev/null
+<?xml version="1.0"?>
+<interface>
+ <requires lib="gtk+" version="2.16"/>
+ <!-- interface-naming-policy project-wide -->
+ <object class="GtkWindow" id="MainWindow">
+ <property name="title" translatable="yes">XBoard</property>
+ <signal name="destroy" handler="QuitProc"/>
+ <child>
+ <object class="GtkAspectFrame" id="Aspectframe">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <property name="ratio">0.80000001192092896</property>
+ <child>
+ <object class="GtkVBox" id="VBox">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkMenuBar" id="MenuBar">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkMenuItem" id="MenuItemFile">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_File</property>
+ <property name="use_underline">True</property>
+ <child type="submenu">
+ <object class="GtkMenu" id="MenuFile">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkMenuItem" id="menuFile.Reset Game">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Reset Game</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkSeparatorMenuItem" id="separatormenuitem1">
+ <property name="visible">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkImageMenuItem" id="menuFile.Load Game">
+ <property name="label" translatable="yes">Load Game</property>
+ <property name="visible">True</property>
+ <property name="image">image1</property>
+ <property name="use_stock">False</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="menuFile.Load Next Game">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Load Next Game</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="menuFile.Load Previous Game">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Load Previous Game</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="menuFile.Reload Same Game">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Reload Same Game</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="menuFile.Save Game">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Save Game</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkSeparatorMenuItem" id="separatormenuitem2">
+ <property name="visible">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="menuFile.Copy Game">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Copy Game</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="menuFile.Paste Game">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Paste Game</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkSeparatorMenuItem" id="separatormenuitem3">
+ <property name="visible">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="menuFile.Load Position">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Load Position</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="menuFile.Load Next Position">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Load Next Position</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="menuFile.Load Previous Position">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Load Previous Position</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="menuFile.Reload Same Position">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Reload Same Position</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="menuFile.Save Position">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Save Position</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkSeparatorMenuItem" id="separatormenuitem4">
+ <property name="visible">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="menuFile.Copy Position">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Copy Position</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="menuFile.Paste Position">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Paste Position</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkSeparatorMenuItem" id="separatormenuitem5">
+ <property name="visible">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="menuFile.Mail Move">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Mail Move</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="menuFile.Reload CMail Message">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Reload CMail Message</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkSeparatorMenuItem" id="separatormenuitem6">
+ <property name="visible">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkImageMenuItem" id="menuFile.Quit">
+ <property name="label">gtk-quit</property>
+ <property name="visible">True</property>
+ <property name="use_underline">True</property>
+ <property name="use_stock">True</property>
+ <signal name="activate" handler="QuitProc"/>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="MenuItemMode">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Mode</property>
+ <property name="use_underline">True</property>
+ <child type="submenu">
+ <object class="GtkMenu" id="menu2">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkRadioMenuItem" id="menuMode.Machine White">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Machine White</property>
+ <property name="use_underline">True</property>
+ <property name="draw_as_radio">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkRadioMenuItem" id="menuMode.Machine Black">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Machine Black</property>
+ <property name="use_underline">True</property>
+ <property name="draw_as_radio">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkRadioMenuItem" id="menuMode.Two Machines">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Two Machines</property>
+ <property name="use_underline">True</property>
+ <property name="draw_as_radio">True</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="MenuItemAction">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Action</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="MenuItemStep">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Step</property>
+ <property name="use_underline">True</property>
+ <child type="submenu">
+ <object class="GtkMenu" id="menu4">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkMenuItem" id="menuStep.Retract Move">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Retract Move</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="MenuItemOptions">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Options</property>
+ <property name="use_underline">True</property>
+ <child type="submenu">
+ <object class="GtkMenu" id="menu5">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkCheckMenuItem" id="menuOptions.Always Queen">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Always Queen</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkCheckMenuItem" id="menuOptions.Animate Dragging">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Animate Dragging</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkCheckMenuItem" id="menuOptions.Animate Moving">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Animate Moving</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkCheckMenuItem" id="menuOptions.Auto Comment">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Auto Comment</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkCheckMenuItem" id="menuOptions.Auto Flag">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Auto Flag</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkCheckMenuItem" id="menuOptions.Auto Flip View">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Auto Flip View</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkCheckMenuItem" id="menuOptions.Auto Observe">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Auto Observe</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkCheckMenuItem" id="menuOptions.Auto Raise Board">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Auto Raise Board</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkCheckMenuItem" id="menuOptions.Auto Save">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Auto Save</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkCheckMenuItem" id="menuOptions.Blindfold">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Blindfold</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkCheckMenuItem" id="menuOptions.Flash Moves">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Flash Moves</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkCheckMenuItem" id="menuOptions.Flip View">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Flip View</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkCheckMenuItem" id="menuOptions.Get Move List">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Get Move List</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkCheckMenuItem" id="menuOptions.Highlight Last Move">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Highlight Last Move</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkCheckMenuItem" id="menuOptions.Move Sound">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Move Sound</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkCheckMenuItem" id="menuOptions.ICS Alarm">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">ICS Alarm</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkCheckMenuItem" id="menuOptions.Old Save Style">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Old Save Style</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkCheckMenuItem" id="menuOptions.Periodic Updates">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Periodic Updates</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkCheckMenuItem" id="menuOptions.Ponder Next Move">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Ponder Next Move</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkCheckMenuItem" id="menuOptions.Popup Exit Message">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Popup Exit Message</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkCheckMenuItem" id="menuOptions.Popup Move Errors">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Popup Move Errors</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkCheckMenuItem" id="menuOptions.Premove">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Premove</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkCheckMenuItem" id="menuOptions.Quiet Play">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Quiet Play</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkCheckMenuItem" id="menuOptions.Show Coords">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Show Coords</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkCheckMenuItem" id="menuOptions.Show Thinking">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Show Thinking</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkCheckMenuItem" id="menuOptions.Test Legality">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Test Legality</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="MenuItemHelp">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Help</property>
+ <property name="use_underline">True</property>
+ <child type="submenu">
+ <object class="GtkMenu" id="menu3">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkImageMenuItem" id="imagemenuitem10">
+ <property name="label">gtk-about</property>
+ <property name="visible">True</property>
+ <property name="use_underline">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="Timer">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkEventBox" id="WhiteClockEventBox">
+ <property name="visible">True</property>
+ <signal name="button_press_event" handler="WhiteClockProc"/>
+ <child>
+ <object class="GtkLabel" id="WhiteClock">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">White:</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEventBox" id="BlackClockEventBox">
+ <property name="visible">True</property>
+ <signal name="button_press_event" handler="BlackClockProc"/>
+ <child>
+ <object class="GtkLabel" id="BlackClock">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Black:</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="Messages">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">not your turn</property>
+ <property name="single_line_mode">True</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button1">
+ <property name="label" translatable="yes"><<</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button2">
+ <property name="label" translatable="yes"><</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button3">
+ <property name="label" translatable="yes">P</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked" handler="PauseProc"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button4">
+ <property name="label" translatable="yes">></property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button5">
+ <property name="label" translatable="yes">>></property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">5</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkDrawingArea" id="Board">
+ <property name="visible">True</property>
+ <signal name="button_press_event" handler="UserMoveProc"/>
+ <signal name="expose_event" handler="EventProc"/>
+ <signal name="button_release_event" handler="UserMoveProc"/>
+ </object>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <object class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="xalign">0.40000000596046448</property>
+ <property name="stock">gtk-open</property>
+ </object>
+</interface>
#include "bitmaps/bitmaps.h"
#endif
+#include <gtk/gtk.h>
+#include <gdk/gdk.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
#include "bitmaps/icon_white.bm"
#include "bitmaps/icon_black.bm"
#include "bitmaps/checkmark.bm"
#include "xhistory.h"
#include "xedittags.h"
#include "gettext.h"
+#include "callback.h"
+#include "interface.h"
// must be moved to xengineoutput.h
String *params, Cardinal *num_params));
static void PieceMenuSelect P((Widget w, ChessSquare piece, caddr_t junk));
static void DropMenuSelect P((Widget w, ChessSquare piece, caddr_t junk));
-void ReadBitmap P((Pixmap *pm, String name, unsigned char bits[],
- u_int wreq, u_int hreq));
void CreateGrid P((void));
int EventToSquare P((int x, int limit));
void DrawSquare P((int row, int column, ChessSquare piece, int do_flash));
-void EventProc P((Widget widget, caddr_t unused, XEvent *event));
void HandleUserMove P((Widget w, XEvent *event,
String *prms, Cardinal *nprms));
void AnimateUserMove P((Widget w, XEvent * event,
String *prms, Cardinal *nprms));
void DrawPositionProc P((Widget w, XEvent *event,
String *prms, Cardinal *nprms));
-void XDrawPosition P((Widget w, /*Boolean*/int repaint,
- Board board));
void CommentPopUp P((char *title, char *label));
void CommentPopDown P((void));
void CommentCallback P((Widget w, XtPointer client_data,
void EditCommentCallback P((Widget w, XtPointer client_data,
XtPointer call_data));
void SelectCommand P((Widget w, XtPointer client_data, XtPointer call_data));
-void ResetProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
-void LoadGameProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
-void LoadNextGameProc P((Widget w, XEvent *event, String *prms,
- Cardinal *nprms));
-void LoadPrevGameProc P((Widget w, XEvent *event, String *prms,
- Cardinal *nprms));
-void ReloadGameProc P((Widget w, XEvent *event, String *prms,
- Cardinal *nprms));
void LoadPositionProc P((Widget w, XEvent *event,
String *prms, Cardinal *nprms));
void LoadNextPositionProc P((Widget w, XEvent *event, String *prms,
void MailMoveProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
void ReloadCmailMsgProc P((Widget w, XEvent *event, String *prms,
Cardinal *nprms));
-void QuitProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
-void PauseProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
void MachineBlackProc P((Widget w, XEvent *event, String *prms,
Cardinal *nprms));
void MachineWhiteProc P((Widget w, XEvent *event,
Cardinal *nprms));
void PremoveProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
void QuietPlayProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
-void ShowCoordsProc P((Widget w, XEvent *event, String *prms,
- Cardinal *nprms));
void ShowThinkingProc P((Widget w, XEvent *event, String *prms,
Cardinal *nprms));
void HideThinkingProc P((Widget w, XEvent *event, String *prms,
void HintProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
void BookProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
void AboutGameProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
-void AboutProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
void DebugProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
void NothingProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
void Iconify P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
void ErrorPopDown P((void));
static char *ExpandPathName P((char *path));
static void CreateAnimVars P((void));
-static void DragPieceBegin P((int x, int y));
+void DragPieceBegin P((int x, int y));
static void DragPieceMove P((int x, int y));
-static void DragPieceEnd P((int x, int y));
+void DragPieceEnd P((int x, int y));
static void DrawDragPiece P((void));
char *ModeToWidgetName P((GameMode mode));
void EngineOutputUpdate( FrontEndProgramStats * stats );
commentShell, promotionShell, whitePieceMenu, blackPieceMenu, dropMenu,
menuBarWidget, buttonBarWidget, editShell, errorShell, analysisShell,
ICSInputShell, fileNameShell, askQuestionShell;
-XSegment gridSegments[(BOARD_SIZE + 1) * 2];
+GdkSegment gridSegments[(BOARD_SIZE + 1) * 2];
XSegment jailGridSegments[(BOARD_SIZE + 3) * 2];
Font clockFontID, coordFontID, countFontID;
XFontStruct *clockFontStruct, *coordFontStruct, *countFontStruct;
SizeDefaults sizeDefaults[] = SIZE_DEFAULTS;
MenuItem fileMenu[] = {
- {N_("New Game"), ResetProc},
{N_("New Shuffle Game ..."), ShuffleMenuProc},
{N_("New Variant ..."), NewVariantProc}, // [HGM] variant: not functional yet
{"----", NothingProc},
- {N_("Load Game"), LoadGameProc},
- {N_("Load Next Game"), LoadNextGameProc},
- {N_("Load Previous Game"), LoadPrevGameProc},
- {N_("Reload Same Game"), ReloadGameProc},
{N_("Save Game"), SaveGameProc},
{"----", NothingProc},
{N_("Copy Game"), CopyGameProc},
{N_("Mail Move"), MailMoveProc},
{N_("Reload CMail Message"), ReloadCmailMsgProc},
{"----", NothingProc},
- {N_("Exit"), QuitProc},
{NULL, NULL}
};
{N_("Edit Tags"), EditTagsProc},
{N_("Edit Comment"), EditCommentProc},
{N_("ICS Input Box"), IcsInputBoxProc},
- {N_("Pause"), PauseProc},
{NULL, NULL}
};
{N_("Popup Move Errors"), PopupMoveErrorsProc},
{N_("Premove"), PremoveProc},
{N_("Quiet Play"), QuietPlayProc},
- {N_("Show Coords"), ShowCoordsProc},
{N_("Hide Thinking"), HideThinkingProc},
{N_("Test Legality"), TestLegalityProc},
{NULL, NULL}
{N_("Hint"), HintProc},
{N_("Book"), BookProc},
{"----", NothingProc},
- {N_("About XBoard"), AboutProc},
{NULL, NULL}
};
MenuItem buttonBar[] = {
{"<<", ToStartProc},
{"<", BackwardProc},
- {PAUSE_BUTTON, PauseProc},
+ // {PAUSE_BUTTON, PauseProc},
{">", ForwardProc},
{">>", ToEndProc},
{NULL, NULL}
{ "WhiteClock", WhiteClock },
{ "BlackClock", BlackClock },
{ "Iconify", Iconify },
- { "ResetProc", ResetProc },
- { "LoadGameProc", LoadGameProc },
- { "LoadNextGameProc", LoadNextGameProc },
- { "LoadPrevGameProc", LoadPrevGameProc },
{ "LoadSelectedProc", LoadSelectedProc },
- { "ReloadGameProc", ReloadGameProc },
{ "LoadPositionProc", LoadPositionProc },
{ "LoadNextPositionProc", LoadNextPositionProc },
{ "LoadPrevPositionProc", LoadPrevPositionProc },
{ "SavePositionProc", SavePositionProc },
{ "MailMoveProc", MailMoveProc },
{ "ReloadCmailMsgProc", ReloadCmailMsgProc },
- { "QuitProc", QuitProc },
{ "MachineWhiteProc", MachineWhiteProc },
{ "MachineBlackProc", MachineBlackProc },
{ "AnalysisModeProc", AnalyzeModeProc },
{ "EditCommentProc", EditCommentProc },
{ "IcsAlarmProc", IcsAlarmProc },
{ "IcsInputBoxProc", IcsInputBoxProc },
- { "PauseProc", PauseProc },
{ "AcceptProc", AcceptProc },
{ "DeclineProc", DeclineProc },
{ "RematchProc", RematchProc },
{ "PopupMoveErrorsProc", PopupMoveErrorsProc },
{ "PremoveProc", PremoveProc },
{ "QuietPlayProc", QuietPlayProc },
- { "ShowCoordsProc", ShowCoordsProc },
{ "ShowThinkingProc", ShowThinkingProc },
{ "HideThinkingProc", HideThinkingProc },
{ "TestLegalityProc", TestLegalityProc },
{ "HintProc", HintProc },
{ "BookProc", BookProc },
{ "AboutGameProc", AboutGameProc },
- { "AboutProc", AboutProc },
{ "DebugProc", DebugProc },
{ "NothingProc", NothingProc },
{ "CommentPopDown", (XtActionProc) CommentPopDown },
char globalTranslations[] =
":<Key>R: ResignProc() \n \
- :<Key>r: ResetProc() \n \
- :<Key>g: LoadGameProc() \n \
- :<Key>N: LoadNextGameProc() \n \
- :<Key>P: LoadPrevGameProc() \n \
- :<Key>Q: QuitProc() \n \
:<Key>F: ToEndProc() \n \
:<Key>f: ForwardProc() \n \
:<Key>B: ToStartProc() \n \
:<Key>b: BackwardProc() \n \
- :<Key>p: PauseProc() \n \
:<Key>d: DrawProc() \n \
:<Key>t: CallFlagProc() \n \
:<Key>i: Iconify() \n \
/*
* Enable shell resizing.
*/
- shellArgs[0].value = (XtArgVal) &w;
- shellArgs[1].value = (XtArgVal) &h;
- XtGetValues(shellWidget, shellArgs, 2);
-
- shellArgs[4].value = 2*w; shellArgs[2].value = 10;
- shellArgs[5].value = 2*h; shellArgs[3].value = 10;
- XtSetValues(shellWidget, &shellArgs[2], 4);
-
- XtSetArg(args[0], XtNdefaultDistance, &sep);
- XtGetValues(formWidget, args, 1);
+// shellArgs[0].value = (XtArgVal) &w;
+// shellArgs[1].value = (XtArgVal) &h;
+// XtGetValues(shellWidget, shellArgs, 2);
+//
+// shellArgs[4].value = 2*w; shellArgs[2].value = 10;
+// shellArgs[5].value = 2*h; shellArgs[3].value = 10;
+// XtSetValues(shellWidget, &shellArgs[2], 4);
+//
+// XtSetArg(args[0], XtNdefaultDistance, &sep);
+// XtGetValues(formWidget, args, 1);
boardWidth = lineGap + BOARD_WIDTH * (squareSize + lineGap);
boardHeight = lineGap + BOARD_HEIGHT * (squareSize + lineGap);
CreateGrid();
- XtSetArg(args[0], XtNwidth, boardWidth);
- XtSetArg(args[1], XtNheight, boardHeight);
- XtSetValues(boardWidget, args, 2);
+// XtSetArg(args[0], XtNwidth, boardWidth);
+// XtSetArg(args[1], XtNheight, boardHeight);
+// XtSetValues(boardWidget, args, 2);
timerWidth = (boardWidth - sep) / 2;
- XtSetArg(args[0], XtNwidth, timerWidth);
- XtSetValues(whiteTimerWidget, args, 1);
- XtSetValues(blackTimerWidget, args, 1);
-
- XawFormDoLayout(formWidget, False);
+// XtSetArg(args[0], XtNwidth, timerWidth);
+// XtSetValues(whiteTimerWidget, args, 1);
+// XtSetValues(blackTimerWidget, args, 1);
+//
+// XawFormDoLayout(formWidget, False);
if (appData.titleInWindow) {
i = 0;
- XtSetArg(args[i], XtNborderWidth, &bor); i++;
- XtSetArg(args[i], XtNheight, &h); i++;
- XtGetValues(titleWidget, args, i);
+// XtSetArg(args[i], XtNborderWidth, &bor); i++;
+// XtSetArg(args[i], XtNheight, &h); i++;
+// XtGetValues(titleWidget, args, i);
if (smallLayout) {
w = boardWidth - 2*bor;
} else {
- XtSetArg(args[0], XtNwidth, &w);
- XtGetValues(menuBarWidget, args, 1);
+// XtSetArg(args[0], XtNwidth, &w);
+// XtGetValues(menuBarWidget, args, 1);
w = boardWidth - w - sep - 2*bor - 2; // WIDTH_FUDGE
}
- gres = XtMakeResizeRequest(titleWidget, w, h, &wr, &hr);
- if (gres != XtGeometryYes && appData.debugMode) {
- fprintf(stderr,
- _("%s: titleWidget geometry error %d %d %d %d %d\n"),
- programName, gres, w, h, wr, hr);
- }
+// gres = XtMakeResizeRequest(titleWidget, w, h, &wr, &hr);
+// if (gres != XtGeometryYes && appData.debugMode) {
+// fprintf(stderr,
+// _("%s: titleWidget geometry error %d %d %d %d %d\n"),
+// programName, gres, w, h, wr, hr);
+// }
}
- XawFormDoLayout(formWidget, True);
+ // XawFormDoLayout(formWidget, True);
/*
* Inhibit shell resizing.
shellArgs[1].value = h = (XtArgVal) boardHeight + marginH;
shellArgs[4].value = shellArgs[2].value = w;
shellArgs[5].value = shellArgs[3].value = h;
- XtSetValues(shellWidget, &shellArgs[0], 6);
+ // XtSetValues(shellWidget, &shellArgs[0], 6);
// [HGM] pieces: tailor piece bitmaps to needs of specific variant
// (only for xpm)
XtAppInitialize(&appContext, "XBoard", shellOptions,
XtNumber(shellOptions),
&argc, argv, xboardResources, NULL, 0);
+
+ gtk_init (&argc, &argv);
+
+ /* parse glade file */
+
+ builder = gtk_builder_new ();
+ gtk_builder_add_from_file (builder, "gtk-interface.xml", NULL);
+
+ GUI_Window = GTK_WIDGET (gtk_builder_get_object (builder, "MainWindow"));
+ if(!GUI_Window) printf("Error: gtk_builder didn't work!\n");
+ GUI_Board = GTK_WIDGET (gtk_builder_get_object (builder, "Board"));
+ if(!GUI_Board) printf("Error: gtk_builder didn't work!\n");
+ GUI_Whiteclock = GTK_WIDGET (gtk_builder_get_object (builder, "WhiteClock"));
+ if(!GUI_Whiteclock) printf("Error: gtk_builder didn't work!\n");
+ GUI_Blackclock = GTK_WIDGET (gtk_builder_get_object (builder, "BlackClock"));
+ if(!GUI_Blackclock) printf("Error: gtk_builder didn't work!\n");
+
+ gtk_builder_connect_signals (builder, NULL);
+ // don't unref the builder, since we use it to get references to widgets
+ // g_object_unref (G_OBJECT (builder));
+
+ printf("DEBUG:finished building gtk\n");
+ /* end parse glade file */
+
if (argc > 1) {
fprintf(stderr, _("%s: unrecognized argument %s\n"),
programName, argv[1]);
textColors[ColorNone].fg = textColors[ColorNone].bg = -1;
textColors[ColorNone].attr = 0;
- XtAppAddActions(appContext, boardActions, XtNumber(boardActions));
+ printf("DEBUG: I'm here 0\n");
+
+ // XtAppAddActions(appContext, boardActions, XtNumber(boardActions));
/*
* widget hierarchy
XtSetArg(args[1], XtNtop, XtChainTop);
XtSetArg(args[2], XtNbottom, XtChainTop);
XtSetValues(blackTimerWidget, args, 3);
+ printf("DEBUG: I'm here 1\n");
if (appData.titleInWindow) {
widgetList[j++] = titleWidget =
XtSetValues(buttonBarWidget, args, 4);
}
- widgetList[j++] = messageWidget =
- XtCreateWidget("message", labelWidgetClass, formWidget,
- messageArgs, XtNumber(messageArgs));
- XtSetArg(args[0], XtNtop, XtChainTop);
- XtSetArg(args[1], XtNbottom, XtChainTop);
- XtSetValues(messageWidget, args, 2);
-
- widgetList[j++] = boardWidget =
- XtCreateWidget("board", widgetClass, formWidget, boardArgs,
- XtNumber(boardArgs));
+// widgetList[j++] = messageWidget =
+// XtCreateWidget("message", labelWidgetClass, formWidget,
+// messageArgs, XtNumber(messageArgs));
+// XtSetArg(args[0], XtNtop, XtChainTop);
+// XtSetArg(args[1], XtNbottom, XtChainTop);
+// XtSetValues(messageWidget, args, 2);
+//
+// widgetList[j++] = boardWidget =
+// XtCreateWidget("board", widgetClass, formWidget, boardArgs,
+// XtNumber(boardArgs));
+//
+// XtManageChildren(widgetList, j);
+//
+// timerWidth = (boardWidth - sep) / 2;
+// XtSetArg(args[0], XtNwidth, timerWidth);
+// XtSetValues(whiteTimerWidget, args, 1);
+// XtSetValues(blackTimerWidget, args, 1);
+//
+// XtSetArg(args[0], XtNbackground, &timerBackgroundPixel);
+// XtSetArg(args[1], XtNforeground, &timerForegroundPixel);
+// XtGetValues(whiteTimerWidget, args, 2);
+//
+// if (appData.showButtonBar) {
+// XtSetArg(args[0], XtNbackground, &buttonBackgroundPixel);
+// XtSetArg(args[1], XtNforeground, &buttonForegroundPixel);
+// XtGetValues(XtNameToWidget(buttonBarWidget, PAUSE_BUTTON), args, 2);
+// }
+//
- XtManageChildren(widgetList, j);
+ /*
+ * gtk set properties of widgets
+ */
- timerWidth = (boardWidth - sep) / 2;
- XtSetArg(args[0], XtNwidth, timerWidth);
- XtSetValues(whiteTimerWidget, args, 1);
- XtSetValues(blackTimerWidget, args, 1);
+ /* set board size */
+ gtk_widget_set_size_request(GTK_WIDGET(GUI_Board),
+ boardWidth,boardHeight);
- XtSetArg(args[0], XtNbackground, &timerBackgroundPixel);
- XtSetArg(args[1], XtNforeground, &timerForegroundPixel);
- XtGetValues(whiteTimerWidget, args, 2);
+ /* end gtk set properties of widgets */
- if (appData.showButtonBar) {
- XtSetArg(args[0], XtNbackground, &buttonBackgroundPixel);
- XtSetArg(args[1], XtNforeground, &buttonForegroundPixel);
- XtGetValues(XtNameToWidget(buttonBarWidget, PAUSE_BUTTON), args, 2);
- }
+ printf("DEBUG: made it.\n");
/*
* formWidget uses these constraints but they are stored
* in the children.
*/
- i = 0;
- XtSetArg(args[i], XtNfromHoriz, 0); i++;
- XtSetValues(menuBarWidget, args, i);
- if (appData.titleInWindow) {
- if (smallLayout) {
- i = 0;
- XtSetArg(args[i], XtNfromVert, menuBarWidget); i++;
- XtSetValues(whiteTimerWidget, args, i);
- i = 0;
- XtSetArg(args[i], XtNfromVert, menuBarWidget); i++;
- XtSetArg(args[i], XtNfromHoriz, whiteTimerWidget); i++;
- XtSetValues(blackTimerWidget, args, i);
- i = 0;
- XtSetArg(args[i], XtNfromVert, whiteTimerWidget); i++;
- XtSetArg(args[i], XtNjustify, XtJustifyLeft); i++;
- XtSetValues(titleWidget, args, i);
- i = 0;
- XtSetArg(args[i], XtNfromVert, titleWidget); i++;
- XtSetArg(args[i], XtNresizable, (XtArgVal) True); i++;
- XtSetValues(messageWidget, args, i);
- if (appData.showButtonBar) {
- i = 0;
- XtSetArg(args[i], XtNfromVert, titleWidget); i++;
- XtSetArg(args[i], XtNfromHoriz, messageWidget); i++;
- XtSetValues(buttonBarWidget, args, i);
- }
- } else {
- i = 0;
- XtSetArg(args[i], XtNfromVert, titleWidget); i++;
- XtSetValues(whiteTimerWidget, args, i);
- i = 0;
- XtSetArg(args[i], XtNfromVert, titleWidget); i++;
- XtSetArg(args[i], XtNfromHoriz, whiteTimerWidget); i++;
- XtSetValues(blackTimerWidget, args, i);
- i = 0;
- XtSetArg(args[i], XtNfromHoriz, menuBarWidget); i++;
- XtSetValues(titleWidget, args, i);
- i = 0;
- XtSetArg(args[i], XtNfromVert, whiteTimerWidget); i++;
- XtSetArg(args[i], XtNresizable, (XtArgVal) True); i++;
- XtSetValues(messageWidget, args, i);
- if (appData.showButtonBar) {
- i = 0;
- XtSetArg(args[i], XtNfromVert, whiteTimerWidget); i++;
- XtSetArg(args[i], XtNfromHoriz, messageWidget); i++;
- XtSetValues(buttonBarWidget, args, i);
- }
- }
- } else {
- i = 0;
- XtSetArg(args[i], XtNfromVert, menuBarWidget); i++;
- XtSetValues(whiteTimerWidget, args, i);
- i = 0;
- XtSetArg(args[i], XtNfromVert, menuBarWidget); i++;
- XtSetArg(args[i], XtNfromHoriz, whiteTimerWidget); i++;
- XtSetValues(blackTimerWidget, args, i);
- i = 0;
- XtSetArg(args[i], XtNfromVert, whiteTimerWidget); i++;
- XtSetArg(args[i], XtNresizable, (XtArgVal) True); i++;
- XtSetValues(messageWidget, args, i);
- if (appData.showButtonBar) {
- i = 0;
- XtSetArg(args[i], XtNfromVert, whiteTimerWidget); i++;
- XtSetArg(args[i], XtNfromHoriz, messageWidget); i++;
- XtSetValues(buttonBarWidget, args, i);
- }
- }
- i = 0;
- XtSetArg(args[0], XtNfromVert, messageWidget);
- XtSetArg(args[1], XtNtop, XtChainTop);
- XtSetArg(args[2], XtNbottom, XtChainBottom);
- XtSetArg(args[3], XtNleft, XtChainLeft);
- XtSetArg(args[4], XtNright, XtChainRight);
- XtSetValues(boardWidget, args, 5);
-
- XtRealizeWidget(shellWidget);
+// i = 0;
+// XtSetArg(args[i], XtNfromHoriz, 0); i++;
+// XtSetValues(menuBarWidget, args, i);
+// if (appData.titleInWindow) {
+// if (smallLayout) {
+// printf("DEBUG: made it a.\n");
+// i = 0;
+// XtSetArg(args[i], XtNfromVert, menuBarWidget); i++;
+// XtSetValues(whiteTimerWidget, args, i);
+// i = 0;
+// XtSetArg(args[i], XtNfromVert, menuBarWidget); i++;
+// XtSetArg(args[i], XtNfromHoriz, whiteTimerWidget); i++;
+// XtSetValues(blackTimerWidget, args, i);
+// i = 0;
+// XtSetArg(args[i], XtNfromVert, whiteTimerWidget); i++;
+// XtSetArg(args[i], XtNjustify, XtJustifyLeft); i++;
+// XtSetValues(titleWidget, args, i);
+// i = 0;
+// XtSetArg(args[i], XtNfromVert, titleWidget); i++;
+// XtSetArg(args[i], XtNresizable, (XtArgVal) True); i++;
+// XtSetValues(messageWidget, args, i);
+// if (appData.showButtonBar) {
+// i = 0;
+// XtSetArg(args[i], XtNfromVert, titleWidget); i++;
+// XtSetArg(args[i], XtNfromHoriz, messageWidget); i++;
+// XtSetValues(buttonBarWidget, args, i);
+// }
+// } else {
+// printf("DEBUG: made it b.\n");
+// i = 0;
+// XtSetArg(args[i], XtNfromVert, titleWidget); i++;
+// XtSetValues(whiteTimerWidget, args, i);
+// i = 0;
+// XtSetArg(args[i], XtNfromVert, titleWidget); i++;
+// XtSetArg(args[i], XtNfromHoriz, whiteTimerWidget); i++;
+// XtSetValues(blackTimerWidget, args, i);
+// i = 0;
+// XtSetArg(args[i], XtNfromHoriz, menuBarWidget); i++;
+// XtSetValues(titleWidget, args, i);
+// i = 0;
+// XtSetArg(args[i], XtNfromVert, whiteTimerWidget); i++;
+// XtSetArg(args[i], XtNresizable, (XtArgVal) True); i++;
+// XtSetValues(messageWidget, args, i);
+// if (appData.showButtonBar) {
+// i = 0;
+// XtSetArg(args[i], XtNfromVert, whiteTimerWidget); i++;
+// XtSetArg(args[i], XtNfromHoriz, messageWidget); i++;
+// XtSetValues(buttonBarWidget, args, i);
+// }
+// }
+// } else { printf("DEBUG: made it c.\n");
+//
+// i = 0;
+// XtSetArg(args[i], XtNfromVert, menuBarWidget); i++;
+// XtSetValues(whiteTimerWidget, args, i);
+// i = 0;
+// XtSetArg(args[i], XtNfromVert, menuBarWidget); i++;
+// XtSetArg(args[i], XtNfromHoriz, whiteTimerWidget); i++;
+// XtSetValues(blackTimerWidget, args, i);
+// i = 0;
+// XtSetArg(args[i], XtNfromVert, whiteTimerWidget); i++;
+// XtSetArg(args[i], XtNresizable, (XtArgVal) True); i++;
+// XtSetValues(messageWidget, args, i);
+// if (appData.showButtonBar) {
+// i = 0;
+// XtSetArg(args[i], XtNfromVert, whiteTimerWidget); i++;
+// XtSetArg(args[i], XtNfromHoriz, messageWidget); i++;
+// XtSetValues(buttonBarWidget, args, i);
+// }
+// }
+// printf("DEBUG: made it 1.\n");
+// i = 0;
+// XtSetArg(args[0], XtNfromVert, messageWidget);
+// XtSetArg(args[1], XtNtop, XtChainTop);
+// XtSetArg(args[2], XtNbottom, XtChainBottom);
+// XtSetArg(args[3], XtNleft, XtChainLeft);
+// XtSetArg(args[4], XtNright, XtChainRight);
+// XtSetValues(boardWidget, args, 5);
+//
+// XtRealizeWidget(shellWidget);
+//
+ printf("DEBUG: made it 2.\n");
/*
* Correct the width of the message and title widgets.
* It is not known why some systems need the extra fudge term.
* The value "2" is probably larger than needed.
*/
- XawFormDoLayout(formWidget, False);
+ // XawFormDoLayout(formWidget, False);
#define WIDTH_FUDGE 2
- i = 0;
- XtSetArg(args[i], XtNborderWidth, &bor); i++;
- XtSetArg(args[i], XtNheight, &h); i++;
- XtGetValues(messageWidget, args, i);
+// i = 0;
+// XtSetArg(args[i], XtNborderWidth, &bor); i++;
+// XtSetArg(args[i], XtNheight, &h); i++;
+// XtGetValues(messageWidget, args, i);
if (appData.showButtonBar) {
- i = 0;
- XtSetArg(args[i], XtNwidth, &w); i++;
- XtGetValues(buttonBarWidget, args, i);
- w = boardWidth - w - sep - 2*bor - WIDTH_FUDGE;
+// i = 0;
+// XtSetArg(args[i], XtNwidth, &w); i++;
+// XtGetValues(buttonBarWidget, args, i);
+// w = boardWidth - w - sep - 2*bor - WIDTH_FUDGE;
} else {
- w = boardWidth - 2*bor + 1; /*!! +1 compensates for kludge below */
+// w = boardWidth - 2*bor + 1; /*!! +1 compensates for kludge below */
}
-
- gres = XtMakeResizeRequest(messageWidget, w, h, &wr, &hr);
+//
+// gres = XtMakeResizeRequest(messageWidget, w, h, &wr, &hr);
if (gres != XtGeometryYes && appData.debugMode) {
fprintf(stderr, _("%s: messageWidget geometry error %d %d %d %d %d\n"),
programName, gres, w, h, wr, hr);
/* The size used for the child widget in layout lags one resize behind
its true size, so we resize a second time, 1 pixel smaller. Yeech! */
w--;
- gres = XtMakeResizeRequest(messageWidget, w, h, &wr, &hr);
+// gres = XtMakeResizeRequest(messageWidget, w, h, &wr, &hr);
if (gres != XtGeometryYes && appData.debugMode) {
fprintf(stderr, _("%s: messageWidget geometry error %d %d %d %d %d\n"),
programName, gres, w, h, wr, hr);
}
/* !! end hack */
- XtSetArg(args[0], XtNleft, XtChainLeft); // [HGM] glue ends for good run-time sizing
- XtSetArg(args[1], XtNright, XtChainRight);
- XtSetValues(messageWidget, args, 2);
-
+// XtSetArg(args[0], XtNleft, XtChainLeft); // [HGM] glue ends for good run-time sizing
+// XtSetArg(args[1], XtNright, XtChainRight);
+// XtSetValues(messageWidget, args, 2);
+//
if (appData.titleInWindow) {
i = 0;
- XtSetArg(args[i], XtNborderWidth, &bor); i++;
- XtSetArg(args[i], XtNheight, &h); i++;
- XtGetValues(titleWidget, args, i);
+// XtSetArg(args[i], XtNborderWidth, &bor); i++;
+// XtSetArg(args[i], XtNheight, &h); i++;
+// XtGetValues(titleWidget, args, i);
if (smallLayout) {
w = boardWidth - 2*bor;
} else {
- XtSetArg(args[0], XtNwidth, &w);
- XtGetValues(menuBarWidget, args, 1);
- w = boardWidth - w - sep - 2*bor - WIDTH_FUDGE;
+// XtSetArg(args[0], XtNwidth, &w);
+// XtGetValues(menuBarWidget, args, 1);
+// w = boardWidth - w - sep - 2*bor - WIDTH_FUDGE;
}
- gres = XtMakeResizeRequest(titleWidget, w, h, &wr, &hr);
+// gres = XtMakeResizeRequest(titleWidget, w, h, &wr, &hr);
if (gres != XtGeometryYes && appData.debugMode) {
fprintf(stderr,
_("%s: titleWidget geometry error %d %d %d %d %d\n"),
programName, gres, w, h, wr, hr);
}
}
- XawFormDoLayout(formWidget, True);
-
- xBoardWindow = XtWindow(boardWidget);
-
+// XawFormDoLayout(formWidget, True);
+//
+// xBoardWindow = XtWindow(boardWidget);
+//
// [HGM] it seems the layout code ends here, but perhaps the color stuff is size independent and would
// not need to go into InitDrawingSizes().
#endif
- /*
- * Create X checkmark bitmap and initialize option menu checks.
- */
- ReadBitmap(&xMarkPixmap, "checkmark.bm",
- checkmark_bits, checkmark_width, checkmark_height);
- XtSetArg(args[0], XtNleftBitmap, xMarkPixmap);
if (appData.alwaysPromoteToQueen) {
- XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.Always Queen"),
- args, 1);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_builder_get_object (builder, "menuOptions.Always Queen")),TRUE);
}
if (appData.animateDragging) {
- XtSetValues(XtNameToWidget(menuBarWidget,
- "menuOptions.Animate Dragging"),
- args, 1);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_builder_get_object (builder, "menuOptions.Animate Dragging")),TRUE);
}
if (appData.animate) {
- XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.Animate Moving"),
- args, 1);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_builder_get_object (builder, "menuOptions.Animate Moving")),TRUE);
}
if (appData.autoComment) {
- XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.Auto Comment"),
- args, 1);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_builder_get_object (builder, "menuOptions.Auto Comment")),TRUE);
}
if (appData.autoCallFlag) {
- XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.Auto Flag"),
- args, 1);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_builder_get_object (builder, "menuOptions.Auto Flag")),TRUE);
}
if (appData.autoFlipView) {
- XtSetValues(XtNameToWidget(menuBarWidget,"menuOptions.Auto Flip View"),
- args, 1);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_builder_get_object (builder, "menuOptions.Auto Flip View")),TRUE);
}
if (appData.autoObserve) {
- XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.Auto Observe"),
- args, 1);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_builder_get_object (builder, "menuOptions.Auto Observe")),TRUE);
}
if (appData.autoRaiseBoard) {
- XtSetValues(XtNameToWidget(menuBarWidget,
- "menuOptions.Auto Raise Board"), args, 1);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_builder_get_object (builder, "menuOptions.Auto Raise Board")),TRUE);
}
if (appData.autoSaveGames) {
- XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.Auto Save"),
- args, 1);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_builder_get_object (builder, "menuOptions.Auto Save")),TRUE);
}
if (appData.saveGameFile[0] != NULLCHAR) {
- /* Can't turn this off from menu */
- XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.Auto Save"),
- args, 1);
- XtSetSensitive(XtNameToWidget(menuBarWidget, "menuOptions.Auto Save"),
- False);
-
+ /* Can't turn this off from menu */
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_builder_get_object (builder, "menuOptions.Auto Save")),TRUE);
+ gtk_action_set_sensitive(GTK_ACTION (gtk_builder_get_object (builder, "menuOptions.Auto Save")),FALSE);
}
if (appData.blindfold) {
- XtSetValues(XtNameToWidget(menuBarWidget,
- "menuOptions.Blindfold"), args, 1);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_builder_get_object (builder, "menuOptions.Blindfold")),TRUE);
}
if (appData.flashCount > 0) {
- XtSetValues(XtNameToWidget(menuBarWidget,
- "menuOptions.Flash Moves"),
- args, 1);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_builder_get_object (builder, "menuOptions.Flash Moves")),TRUE);
}
if (appData.getMoveList) {
- XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.Get Move List"),
- args, 1);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_builder_get_object (builder, "menuOptions.Get Move List")),TRUE);
}
#if HIGHDRAG
if (appData.highlightDragging) {
- XtSetValues(XtNameToWidget(menuBarWidget,
- "menuOptions.Highlight Dragging"),
- args, 1);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_builder_get_object (builder, "menuOptions.Highlight Dragging")),TRUE);
}
#endif
if (appData.highlightLastMove) {
- XtSetValues(XtNameToWidget(menuBarWidget,
- "menuOptions.Highlight Last Move"),
- args, 1);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_builder_get_object (builder, "menuOptions.Highlight Last Move")),TRUE);
}
if (appData.icsAlarm) {
- XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.ICS Alarm"),
- args, 1);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_builder_get_object (builder, "menuOptions.ICS Alarm")),TRUE);
}
if (appData.ringBellAfterMoves) {
- XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.Move Sound"),
- args, 1);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_builder_get_object (builder, "menuOptions.Move Sound")),TRUE);
}
if (appData.oldSaveStyle) {
- XtSetValues(XtNameToWidget(menuBarWidget,
- "menuOptions.Old Save Style"), args, 1);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_builder_get_object (builder, "menuOptions.Old Save Style")),TRUE);
}
if (appData.periodicUpdates) {
- XtSetValues(XtNameToWidget(menuBarWidget,
- "menuOptions.Periodic Updates"), args, 1);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_builder_get_object (builder, "menuOptions.Periodic Updates")),TRUE);
}
if (appData.ponderNextMove) {
- XtSetValues(XtNameToWidget(menuBarWidget,
- "menuOptions.Ponder Next Move"), args, 1);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_builder_get_object (builder, "menuOptions.Ponder Next Move")),TRUE);
}
if (appData.popupExitMessage) {
- XtSetValues(XtNameToWidget(menuBarWidget,
- "menuOptions.Popup Exit Message"), args, 1);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_builder_get_object (builder, "menuOptions.Popup Exit Message")),TRUE);
}
if (appData.popupMoveErrors) {
- XtSetValues(XtNameToWidget(menuBarWidget,
- "menuOptions.Popup Move Errors"), args, 1);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_builder_get_object (builder, "menuOptions.Popup Move Errors")),TRUE);
}
if (appData.premove) {
- XtSetValues(XtNameToWidget(menuBarWidget,
- "menuOptions.Premove"), args, 1);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_builder_get_object (builder, "menuOptions.Premove")),TRUE);
}
if (appData.quietPlay) {
- XtSetValues(XtNameToWidget(menuBarWidget,
- "menuOptions.Quiet Play"), args, 1);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_builder_get_object (builder, "menuOptions.Quit Play")),TRUE);
}
if (appData.showCoords) {
- XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.Show Coords"),
- args, 1);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_builder_get_object (builder, "menuOptions.Show Coords")),TRUE);
}
- if (appData.hideThinkingFromHuman) {
- XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.Hide Thinking"),
- args, 1);
+ if (appData.showThinking) {
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_builder_get_object (builder, "menuOptions.Show Thinking")),TRUE);
}
if (appData.testLegality) {
- XtSetValues(XtNameToWidget(menuBarWidget,"menuOptions.Test Legality"),
- args, 1);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_builder_get_object (builder, "menuOptions.Test Legality")),TRUE);
}
/*
* Create an icon.
*/
- ReadBitmap(&wIconPixmap, "icon_white.bm",
- icon_white_bits, icon_white_width, icon_white_height);
- ReadBitmap(&bIconPixmap, "icon_black.bm",
- icon_black_bits, icon_black_width, icon_black_height);
- iconPixmap = wIconPixmap;
- i = 0;
- XtSetArg(args[i], XtNiconPixmap, iconPixmap); i++;
- XtSetValues(shellWidget, args, i);
-
- /*
- * Create a cursor for the board widget.
- */
- window_attributes.cursor = XCreateFontCursor(xDisplay, XC_hand2);
- XChangeWindowAttributes(xDisplay, xBoardWindow,
- CWCursor, &window_attributes);
-
- /*
- * Inhibit shell resizing.
- */
- shellArgs[0].value = (XtArgVal) &w;
- shellArgs[1].value = (XtArgVal) &h;
- XtGetValues(shellWidget, shellArgs, 2);
- shellArgs[4].value = shellArgs[2].value = w;
- shellArgs[5].value = shellArgs[3].value = h;
- XtSetValues(shellWidget, &shellArgs[2], 4);
- marginW = w - boardWidth; // [HGM] needed to set new shellWidget size when we resize board
- marginH = h - boardHeight;
-
- CatchDeleteWindow(shellWidget, "QuitProc");
+// ReadBitmap(&wIconPixmap, "icon_white.bm",
+// icon_white_bits, icon_white_width, icon_white_height);
+// ReadBitmap(&bIconPixmap, "icon_black.bm",
+// icon_black_bits, icon_black_width, icon_black_height);
+// iconPixmap = wIconPixmap;
+// i = 0;
+// XtSetArg(args[i], XtNiconPixmap, iconPixmap); i++;
+// XtSetValues(shellWidget, args, i);
+//
+
+ printf("DEBUG: creating svgs.\n");
+
+ /* load square colors */
+ SVGLightSquare = load_pixbuf("svg/LightSquare.svg");
+ SVGDarkSquare = load_pixbuf("svg/DarkSquare.svg");
+ SVGNeutralSquare = load_pixbuf("svg/NeutralSquare.svg");
+
+ /* use two icons to indicate if it is white's or black's turn */
+ WhiteIcon = load_pixbuf("svg/icon_white.svg");
+ BlackIcon = load_pixbuf("svg/icon_black.svg");
+ WindowIcon = WhiteIcon;
+ gtk_window_set_icon(GTK_WINDOW(GUI_Window),WindowIcon);
+
+ /* do resizing to a fixed aspect ratio */
+ GdkGeometry hints;
+ hints.min_aspect = 0.8;
+ hints.max_aspect = 0.8;
+ gtk_window_set_geometry_hints (GTK_WINDOW (GUI_Window),
+ GTK_WIDGET (GUI_Window),
+ &hints,
+ GDK_HINT_ASPECT);
+
+ /* realize window */
+ gtk_widget_show (GUI_Window);
CreateGCs();
CreateGrid();
-#if HAVE_LIBXPM
- if (appData.bitmapDirectory[0] != NULLCHAR) {
- CreatePieces();
- } else {
- CreateXPMPieces();
- }
-#else
- CreateXIMPieces();
- /* Create regular pieces */
- if (!useImages) CreatePieces();
-#endif
+ CreatePieces();
CreatePieceMenus();
if (appData.animate || appData.animateDragging)
CreateAnimVars();
- XtAugmentTranslations(formWidget,
- XtParseTranslationTable(globalTranslations));
- XtAugmentTranslations(boardWidget,
- XtParseTranslationTable(boardTranslations));
- XtAugmentTranslations(whiteTimerWidget,
- XtParseTranslationTable(whiteTranslations));
- XtAugmentTranslations(blackTimerWidget,
- XtParseTranslationTable(blackTranslations));
-
- /* Why is the following needed on some versions of X instead
- * of a translation? */
- XtAddEventHandler(boardWidget, ExposureMask, False,
- (XtEventHandler) EventProc, NULL);
- /* end why */
+ printf("DEBUG: created stuff.\n");
+
+// XtAugmentTranslations(formWidget,
+// XtParseTranslationTable(globalTranslations));
+// XtAugmentTranslations(boardWidget,
+// XtParseTranslationTable(boardTranslations));
+// XtAugmentTranslations(whiteTimerWidget,
+// XtParseTranslationTable(whiteTranslations));
+// XtAugmentTranslations(blackTimerWidget,
+// XtParseTranslationTable(blackTranslations));
+//
InitBackEnd2();
+ printf("DEBUG: back end initiated.\n");
+
if (errorExitStatus == -1) {
if (appData.icsActive) {
/* We now wait until we see "login:" from the ICS before
gameInfo.boardWidth = 0; // [HGM] pieces: kludge to ensure InitPosition() calls InitDrawingSizes()
InitPosition(TRUE);
- XtAppMainLoop(appContext);
+ /*
+ * Create a cursor for the board widget.
+ * (This needs to be called after the window has been created to have access to board-window)
+ */
+
+ BoardCursor = gdk_cursor_new(GDK_HAND2);
+ gdk_window_set_cursor(GUI_Board->window, BoardCursor);
+ gdk_cursor_destroy(BoardCursor);
+
+ /* end cursor */
+ printf("DEBUG: going into main.\n");
+
+ gtk_main ();
+
if (appData.debugMode) fclose(debugFP); // [DM] debug
return 0;
}
typedef struct {
char *name;
- Boolean value;
+ gboolean value;
} Enables;
void
SetMenuEnables(enab)
Enables *enab;
{
- Widget w;
- if (!menuBarWidget) return;
+ GObject *o;
+
+ if (!builder) return;
while (enab->name != NULL) {
- w = XtNameToWidget(menuBarWidget, enab->name);
- if (w == NULL) {
- DisplayError(enab->name, 0);
- } else {
- XtSetSensitive(w, enab->value);
- }
+ o = gtk_builder_get_object(builder, enab->name);
+ if(GTK_IS_WIDGET(o))
+ gtk_widget_set_sensitive(GTK_WIDGET (o),enab->value);
+ else
+ {
+ if(GTK_IS_ACTION(o))
+ gtk_action_set_sensitive(GTK_ACTION (o),enab->value);
+ else
+ DisplayError(enab->name, 0);
+ }
enab++;
}
}
}
}
-void loadXIM(xim, xmask, filename, dest, mask)
- XImage *xim;
- XImage *xmask;
- char *filename;
- Pixmap *dest;
- Pixmap *mask;
-{
- int x, y, w, h, p;
- FILE *fp;
- Pixmap temp;
- XGCValues values;
- GC maskGC;
-
- fp = fopen(filename, "rb");
- if (!fp) {
- fprintf(stderr, _("%s: error loading XIM!\n"), programName);
- exit(1);
- }
-
- w = fgetc(fp);
- h = fgetc(fp);
-
- for (y=0; y<h; ++y) {
- for (x=0; x<h; ++x) {
- p = fgetc(fp);
-
- switch (p) {
- case 0:
- XPutPixel(xim, x, y, blackPieceColor);
- if (xmask)
- XPutPixel(xmask, x, y, WhitePixel(xDisplay,xScreen));
- break;
- case 1:
- XPutPixel(xim, x, y, darkSquareColor);
- if (xmask)
- XPutPixel(xmask, x, y, BlackPixel(xDisplay,xScreen));
- break;
- case 2:
- XPutPixel(xim, x, y, whitePieceColor);
- if (xmask)
- XPutPixel(xmask, x, y, WhitePixel(xDisplay,xScreen));
- break;
- case 3:
- XPutPixel(xim, x, y, lightSquareColor);
- if (xmask)
- XPutPixel(xmask, x, y, BlackPixel(xDisplay,xScreen));
- break;
- }
- }
- }
-
- /* create Pixmap of piece */
- *dest = XCreatePixmap(xDisplay, DefaultRootWindow(xDisplay),
- w, h, xim->depth);
- XPutImage(xDisplay, *dest, lightSquareGC, xim,
- 0, 0, 0, 0, w, h);
-
- /* create Pixmap of clipmask
- Note: We assume the white/black pieces have the same
- outline, so we make only 6 masks. This is okay
- since the XPM clipmask routines do the same. */
- if (xmask) {
- temp = XCreatePixmap(xDisplay, DefaultRootWindow(xDisplay),
- w, h, xim->depth);
- XPutImage(xDisplay, temp, lightSquareGC, xmask,
- 0, 0, 0, 0, w, h);
-
- /* now create the 1-bit version */
- *mask = XCreatePixmap(xDisplay, DefaultRootWindow(xDisplay),
- w, h, 1);
-
- values.foreground = 1;
- values.background = 0;
-
- /* Don't use XtGetGC, not read only */
- maskGC = XCreateGC(xDisplay, *mask,
- GCForeground | GCBackground, &values);
- XCopyPlane(xDisplay, temp, *mask, maskGC,
- 0, 0, squareSize, squareSize, 0, 0, 1);
- XFreePixmap(xDisplay, temp);
- }
-}
-
-
-char pieceBitmapNames[] = "pnbrqfeacwmohijgdvlsukpnsl";
-
-void CreateXIMPieces()
-{
- int piece, kind;
- char buf[MSG_SIZ];
- u_int ss;
- static char *ximkind[] = { "ll", "ld", "dl", "dd" };
- XImage *ximtemp;
-
- ss = squareSize;
-
- /* The XSynchronize calls were copied from CreatePieces.
- Not sure if needed, but can't hurt */
- XSynchronize(xDisplay, True); /* Work-around for xlib/xt
- buffering bug */
-
- /* temp needed by loadXIM() */
- ximtemp = XGetImage(xDisplay, DefaultRootWindow(xDisplay),
- 0, 0, ss, ss, AllPlanes, XYPixmap);
-
- if (strlen(appData.pixmapDirectory) == 0) {
- useImages = 0;
- } else {
- useImages = 1;
- if (appData.monoMode) {
- DisplayFatalError(_("XIM pieces cannot be used in monochrome mode"),
- 0, 2);
- ExitEvent(2);
- }
- fprintf(stderr, _("\nLoading XIMs...\n"));
- /* Load pieces */
- for (piece = (int) WhitePawn; piece <= (int) WhiteKing + 4; piece++) {
- fprintf(stderr, "%d", piece+1);
- for (kind=0; kind<4; kind++) {
- fprintf(stderr, ".");
- snprintf(buf, sizeof(buf), "%s/%s%c%s%u.xim",
- ExpandPathName(appData.pixmapDirectory),
- piece <= (int) WhiteKing ? "" : "w",
- pieceBitmapNames[piece],
- ximkind[kind], ss);
- ximPieceBitmap[kind][piece] =
- XGetImage(xDisplay, DefaultRootWindow(xDisplay),
- 0, 0, ss, ss, AllPlanes, XYPixmap);
- if (appData.debugMode)
- fprintf(stderr, _("(File:%s:) "), buf);
- loadXIM(ximPieceBitmap[kind][piece],
- ximtemp, buf,
- &(xpmPieceBitmap2[kind][piece]),
- &(ximMaskPm2[piece]));
- if(piece <= (int)WhiteKing)
- xpmPieceBitmap[kind][piece] = xpmPieceBitmap2[kind][piece];
- }
- fprintf(stderr," ");
- }
- /* Load light and dark squares */
- /* If the LSQ and DSQ pieces don't exist, we will
- draw them with solid squares. */
- snprintf(buf,sizeof(buf), "%s/lsq%u.xim", ExpandPathName(appData.pixmapDirectory), ss);
- if (access(buf, 0) != 0) {
- useImageSqs = 0;
- } else {
- useImageSqs = 1;
- fprintf(stderr, _("light square "));
- ximLightSquare=
- XGetImage(xDisplay, DefaultRootWindow(xDisplay),
- 0, 0, ss, ss, AllPlanes, XYPixmap);
- if (appData.debugMode)
- fprintf(stderr, _("(File:%s:) "), buf);
-
- loadXIM(ximLightSquare, NULL, buf, &xpmLightSquare, NULL);
- fprintf(stderr, _("dark square "));
- snprintf(buf,sizeof(buf), "%s/dsq%u.xim",
- ExpandPathName(appData.pixmapDirectory), ss);
- if (appData.debugMode)
- fprintf(stderr, _("(File:%s:) "), buf);
- ximDarkSquare=
- XGetImage(xDisplay, DefaultRootWindow(xDisplay),
- 0, 0, ss, ss, AllPlanes, XYPixmap);
- loadXIM(ximDarkSquare, NULL, buf, &xpmDarkSquare, NULL);
- xpmJailSquare = xpmLightSquare;
- }
- fprintf(stderr, _("Done.\n"));
- }
- XSynchronize(xDisplay, False); /* Work-around for xlib/xt buffering bug */
-}
-
-#if HAVE_LIBXPM
-void CreateXPMPieces()
-{
- int piece, kind, r;
- char buf[MSG_SIZ];
- u_int ss = squareSize;
- XpmAttributes attr;
- static char *xpmkind[] = { "ll", "ld", "dl", "dd" };
- XpmColorSymbol symbols[4];
-
-#if 0
- /* Apparently some versions of Xpm don't define XpmFormat at all --tpm */
- if (appData.debugMode) {
- fprintf(stderr, "XPM Library Version: %d.%d%c\n",
- XpmFormat, XpmVersion, (char)('a' + XpmRevision - 1));
- }
-#endif
-
- /* The XSynchronize calls were copied from CreatePieces.
- Not sure if needed, but can't hurt */
- XSynchronize(xDisplay, True); /* Work-around for xlib/xt buffering bug */
-
- /* Setup translations so piece colors match square colors */
- symbols[0].name = "light_piece";
- symbols[0].value = appData.whitePieceColor;
- symbols[1].name = "dark_piece";
- symbols[1].value = appData.blackPieceColor;
- symbols[2].name = "light_square";
- symbols[2].value = appData.lightSquareColor;
- symbols[3].name = "dark_square";
- symbols[3].value = appData.darkSquareColor;
-
- attr.valuemask = XpmColorSymbols;
- attr.colorsymbols = symbols;
- attr.numsymbols = 4;
-
- if (appData.monoMode) {
- DisplayFatalError(_("XPM pieces cannot be used in monochrome mode"),
- 0, 2);
- ExitEvent(2);
- }
- if (strlen(appData.pixmapDirectory) == 0) {
- XpmPieces* pieces = builtInXpms;
- useImages = 1;
- /* Load pieces */
- while (pieces->size != squareSize && pieces->size) pieces++;
- if (!pieces->size) {
- fprintf(stderr, _("No builtin XPM pieces of size %d\n"), squareSize);
- exit(1);
- }
- for (piece = (int) WhitePawn; piece <= (int) WhiteKing + 4; piece++) {
- for (kind=0; kind<4; kind++) {
-
- if ((r=XpmCreatePixmapFromData(xDisplay, xBoardWindow,
- pieces->xpm[piece][kind],
- &(xpmPieceBitmap2[kind][piece]),
- NULL, &attr)) != 0) {
- fprintf(stderr, _("Error %d loading XPM image \"%s\"\n"),
- r, buf);
- exit(1);
- }
- if(piece <= (int) WhiteKing)
- xpmPieceBitmap[kind][piece] = xpmPieceBitmap2[kind][piece];
- }
- }
- useImageSqs = 0;
- xpmJailSquare = xpmLightSquare;
- } else {
- useImages = 1;
-
- fprintf(stderr, _("\nLoading XPMs...\n"));
-
- /* Load pieces */
- for (piece = (int) WhitePawn; piece <= (int) WhiteKing + 4; piece++) {
- fprintf(stderr, "%d ", piece+1);
- for (kind=0; kind<4; kind++) {
- snprintf(buf, sizeof(buf), "%s/%s%c%s%u.xpm",
- ExpandPathName(appData.pixmapDirectory),
- piece > (int) WhiteKing ? "w" : "",
- pieceBitmapNames[piece],
- xpmkind[kind], ss);
- if (appData.debugMode) {
- fprintf(stderr, _("(File:%s:) "), buf);
- }
- if ((r=XpmReadFileToPixmap(xDisplay, xBoardWindow, buf,
- &(xpmPieceBitmap2[kind][piece]),
- NULL, &attr)) != 0) {
- fprintf(stderr, _("Error %d loading XPM file \"%s\"\n"),
- r, buf);
- exit(1);
- }
- if(piece <= (int) WhiteKing)
- xpmPieceBitmap[kind][piece] = xpmPieceBitmap2[kind][piece];
- }
- }
- /* Load light and dark squares */
- /* If the LSQ and DSQ pieces don't exist, we will
- draw them with solid squares. */
- fprintf(stderr, _("light square "));
- snprintf(buf, sizeof(buf), "%s/lsq%u.xpm", ExpandPathName(appData.pixmapDirectory), ss);
- if (access(buf, 0) != 0) {
- useImageSqs = 0;
- } else {
- useImageSqs = 1;
- if (appData.debugMode)
- fprintf(stderr, _("(File:%s:) "), buf);
-
- if ((r=XpmReadFileToPixmap(xDisplay, xBoardWindow, buf,
- &xpmLightSquare, NULL, &attr)) != 0) {
- fprintf(stderr, _("Error %d loading XPM file \"%s\"\n"), r, buf);
- exit(1);
- }
- fprintf(stderr, _("dark square "));
- snprintf(buf, sizeof(buf), "%s/dsq%u.xpm",
- ExpandPathName(appData.pixmapDirectory), ss);
- if (appData.debugMode) {
- fprintf(stderr, _("(File:%s:) "), buf);
- }
- if ((r=XpmReadFileToPixmap(xDisplay, xBoardWindow, buf,
- &xpmDarkSquare, NULL, &attr)) != 0) {
- fprintf(stderr, _("Error %d loading XPM file \"%s\"\n"), r, buf);
- exit(1);
- }
- }
- xpmJailSquare = xpmLightSquare;
- fprintf(stderr, _("Done.\n"));
- }
- XSynchronize(xDisplay, False); /* Work-around for xlib/xt
- buffering bug */
-}
-#endif /* HAVE_LIBXPM */
-
-#if HAVE_LIBXPM
-/* No built-in bitmaps */
void CreatePieces()
{
- int piece, kind;
- char buf[MSG_SIZ];
- u_int ss = squareSize;
-
- XSynchronize(xDisplay, True); /* Work-around for xlib/xt
- buffering bug */
-
- for (kind = SOLID; kind <= (appData.monoMode ? OUTLINE : SOLID); kind++) {
- for (piece = (int) WhitePawn; piece <= (int) WhiteKing + 4; piece++) {
- sprintf(buf, "%s%c%u%c.bm", piece > (int)WhiteKing ? "w" : "",
- pieceBitmapNames[piece],
- ss, kind == SOLID ? 's' : 'o');
- ReadBitmap(&pieceBitmap2[kind][piece], buf, NULL, ss, ss);
- if(piece <= (int)WhiteKing)
- pieceBitmap[kind][piece] = pieceBitmap2[kind][piece];
- }
- }
+ /* order of pieces
+ WhitePawn, WhiteKnight, WhiteBishop, WhiteRook, WhiteQueen, WhiteKing,
+ BlackPawn, BlackKnight, BlackBishop, BlackRook, BlackQueen, BlackKing,
+ */
- XSynchronize(xDisplay, False); /* Work-around for xlib/xt
- buffering bug */
-}
-#else
-/* With built-in bitmaps */
-void CreatePieces()
-{
- BuiltInBits* bib = builtInBits;
- int piece, kind;
- char buf[MSG_SIZ];
- u_int ss = squareSize;
-
- XSynchronize(xDisplay, True); /* Work-around for xlib/xt
- buffering bug */
-
- while (bib->squareSize != ss && bib->squareSize != 0) bib++;
-
- for (kind = SOLID; kind <= (appData.monoMode ? OUTLINE : SOLID); kind++) {
- for (piece = (int) WhitePawn; piece <= (int) WhiteKing + 4; piece++) {
- sprintf(buf, "%s%c%u%c.bm", piece > (int)WhiteKing ? "w" : "",
- pieceBitmapNames[piece],
- ss, kind == SOLID ? 's' : 'o');
- ReadBitmap(&pieceBitmap2[kind][piece], buf,
- bib->bits[kind][piece], ss, ss);
- if(piece <= (int)WhiteKing)
- pieceBitmap[kind][piece] = pieceBitmap2[kind][piece];
- }
- }
+ SVGpieces[WhitePawn] = load_pixbuf("svg/WhitePawn.svg");
+ SVGpieces[WhiteKnight] = load_pixbuf("svg/WhiteKnight.svg");
+ SVGpieces[WhiteBishop] = load_pixbuf("svg/WhiteBishop.svg");
+ SVGpieces[WhiteRook] = load_pixbuf("svg/WhiteRook.svg");
+ SVGpieces[WhiteQueen] = load_pixbuf("svg/WhiteQueen.svg");
+ SVGpieces[WhiteKing] = load_pixbuf("svg/WhiteKing.svg");
- XSynchronize(xDisplay, False); /* Work-around for xlib/xt
- buffering bug */
-}
-#endif
+ SVGpieces[BlackPawn] = load_pixbuf("svg/BlackPawn.svg");
+ SVGpieces[BlackKnight] = load_pixbuf("svg/BlackKnight.svg");
+ SVGpieces[BlackBishop] = load_pixbuf("svg/BlackBishop.svg");
+ SVGpieces[BlackRook] = load_pixbuf("svg/BlackRook.svg");
+ SVGpieces[BlackQueen] = load_pixbuf("svg/BlackQueen.svg");
+ SVGpieces[BlackKing] = load_pixbuf("svg/BlackKing.svg");
-void ReadBitmap(pm, name, bits, wreq, hreq)
- Pixmap *pm;
- String name;
- unsigned char bits[];
- u_int wreq, hreq;
-{
- int x_hot, y_hot;
- u_int w, h;
- int errcode;
- char msg[MSG_SIZ], fullname[MSG_SIZ];
-
- if (*appData.bitmapDirectory != NULLCHAR) {
- strcpy(fullname, appData.bitmapDirectory);
- strcat(fullname, "/");
- strcat(fullname, name);
- errcode = XReadBitmapFile(xDisplay, xBoardWindow, fullname,
- &w, &h, pm, &x_hot, &y_hot);
- fprintf(stderr, "load %s\n", name);
- if (errcode != BitmapSuccess) {
- switch (errcode) {
- case BitmapOpenFailed:
- snprintf(msg, sizeof(msg), _("Can't open bitmap file %s"), fullname);
- break;
- case BitmapFileInvalid:
- snprintf(msg, sizeof(msg), _("Invalid bitmap in file %s"), fullname);
- break;
- case BitmapNoMemory:
- snprintf(msg, sizeof(msg), _("Ran out of memory reading bitmap file %s"),
- fullname);
- break;
- default:
- snprintf(msg, sizeof(msg), _("Unknown XReadBitmapFile error %d on file %s"),
- errcode, fullname);
- break;
- }
- fprintf(stderr, _("%s: %s...using built-in\n"),
- programName, msg);
- } else if (w != wreq || h != hreq) {
- fprintf(stderr,
- _("%s: Bitmap %s is %dx%d, not %dx%d...using built-in\n"),
- programName, fullname, w, h, wreq, hreq);
- } else {
- return;
- }
- }
- if (bits == NULL) {
-#if 0
- fprintf(stderr, _("%s: No built-in bitmap for %s; giving up\n"),
- programName, name);
- exit(1);
-#endif
- ; // [HGM] bitmaps: make it non-fatal if we have no bitmap;
- } else {
- *pm = XCreateBitmapFromData(xDisplay, xBoardWindow, (char *) bits,
- wreq, hreq);
- }
+ return;
}
+
void CreateGrid()
{
int i, j;
Arg args[16];
ChessSquare selection;
- whitePieceMenu = CreatePieceMenu("menuW", 0);
- blackPieceMenu = CreatePieceMenu("menuB", 1);
-
- XtRegisterGrabAction(PieceMenuPopup, True,
- (unsigned)(ButtonPressMask|ButtonReleaseMask),
- GrabModeAsync, GrabModeAsync);
-
- XtSetArg(args[0], XtNlabel, _("Drop"));
- dropMenu = XtCreatePopupShell("menuD", simpleMenuWidgetClass,
- boardWidget, args, 1);
- for (i = 0; i < DROP_MENU_SIZE; i++) {
- String item = dropMenuStrings[i];
-
- if (strcmp(item, "----") == 0) {
- entry = XtCreateManagedWidget(item, smeLineObjectClass,
- dropMenu, NULL, 0);
- } else {
- XtSetArg(args[0], XtNlabel, XtNewString(_(item)));
- entry = XtCreateManagedWidget(item, smeBSBObjectClass,
- dropMenu, args, 1);
- selection = dropMenuTranslation[i];
- XtAddCallback(entry, XtNcallback,
- (XtCallbackProc) DropMenuSelect,
- (caddr_t) selection);
- }
- }
+// whitePieceMenu = CreatePieceMenu("menuW", 0);
+// blackPieceMenu = CreatePieceMenu("menuB", 1);
+//
+// XtRegisterGrabAction(PieceMenuPopup, True,
+// (unsigned)(ButtonPressMask|ButtonReleaseMask),
+// GrabModeAsync, GrabModeAsync);
+//
+// XtSetArg(args[0], XtNlabel, _("Drop"));
+// dropMenu = XtCreatePopupShell("menuD", simpleMenuWidgetClass,
+// boardWidget, args, 1);
+// for (i = 0; i < DROP_MENU_SIZE; i++) {
+// String item = dropMenuStrings[i];
+//
+// if (strcmp(item, "----") == 0) {
+// entry = XtCreateManagedWidget(item, smeLineObjectClass,
+// dropMenu, NULL, 0);
+// } else {
+// XtSetArg(args[0], XtNlabel, XtNewString(_(item)));
+// entry = XtCreateManagedWidget(item, smeBSBObjectClass,
+// dropMenu, args, 1);
+// selection = dropMenuTranslation[i];
+// XtAddCallback(entry, XtNcallback,
+// (XtCallbackProc) DropMenuSelect,
+// (caddr_t) selection);
+// }
+// }
}
void SetupDropMenu()
Drawable dest;
{
if (useImages && useImageSqs) {
- Pixmap pm;
- switch (color) {
- case 1: /* light */
- pm = xpmLightSquare;
- break;
- case 0: /* dark */
- pm = xpmDarkSquare;
- break;
- case 2: /* neutral */
- default:
- pm = xpmJailSquare;
- break;
- }
- XCopyArea(xDisplay, pm, dest, wlPieceGC, 0, 0,
- squareSize, squareSize, x, y);
+ GdkPixbuf *pb;
+ switch (color) {
+ case 1: /* light */
+ pb = SVGLightSquare;
+ break;
+ case 0: /* dark */
+ pb = SVGDarkSquare;
+ break;
+ case 2: /* neutral */
+ default:
+ pb = SVGNeutralSquare;
+ break;
+ }
+ gdk_draw_pixbuf(GDK_WINDOW(GUI_Board->window),NULL,pb,0,0,x,y,-1,-1, GDK_RGB_DITHER_NORMAL, 0, 0);
} else {
- GC gc;
- switch (color) {
- case 1: /* light */
- gc = lightSquareGC;
- break;
- case 0: /* dark */
- gc = darkSquareGC;
- break;
- case 2: /* neutral */
- default:
- gc = jailSquareGC;
- break;
- }
- XFillRectangle(xDisplay, dest, gc, x, y, squareSize, squareSize);
+ GdkGC *gc;
+ GdkColor tmp;
+
+ gc = gdk_gc_new(GDK_WINDOW(GUI_Board->window));
+
+ switch (color) {
+ case 1: /* light */
+ // gc = lightSquareGC;
+ tmp.green=60000;
+ tmp.red=63330;
+ tmp.blue=60000;
+ gdk_gc_set_rgb_fg_color(gc, &tmp);
+ break;
+ case 0: /* dark */
+ // gc = darkSquareGC;
+ tmp.green=10000;
+ tmp.red=13330;
+ tmp.blue=1234;
+ gdk_gc_set_rgb_fg_color(gc, &tmp);
+ break;
+ case 2: /* neutral */
+ default:
+ // gc = jailSquareGC;
+ tmp.green=30000;
+ tmp.red=33330;
+ tmp.blue=30234;
+ gdk_gc_set_rgb_fg_color(gc, &tmp);
+ break;
+ }
+ gdk_draw_rectangle(GDK_WINDOW(GUI_Board->window),gc,1,x,y,squareSize,squareSize);
+
}
}
}
-/* Why is this needed on some versions of X? */
-void EventProc(widget, unused, event)
- Widget widget;
- caddr_t unused;
- XEvent *event;
-{
- if (!XtIsRealized(widget))
- return;
-
- switch (event->type) {
- case Expose:
- if (event->xexpose.count > 0) return; /* no clipping is done */
- XDrawPosition(widget, True, NULL);
- break;
- default:
- return;
- }
-}
-/* end why */
-
-void DrawPosition(fullRedraw, board)
- /*Boolean*/int fullRedraw;
- Board board;
-{
- XDrawPosition(boardWidget, fullRedraw, board);
-}
-
/* Returns 1 if there are "too many" differences between b1 and b2
(i.e. more than 1 move was made) */
static int too_many_diffs(b1, b2)
/*
* event handler for redrawing the board
*/
-void XDrawPosition(w, repaint, board)
- Widget w;
+void DrawPosition( repaint, board)
/*Boolean*/int repaint;
Board board;
{
Arg args[16];
int rrow, rcol;
+ printf ("DEBUG: in draw position\n");
+
+
if (board == NULL) {
if (!lastBoardValid) return;
board = lastBoard;
* but this causes a very distracting flicker.
*/
+ printf ("DEBUG: in draw position 0.1\n");
+
+
if (!repaint && lastBoardValid && lastFlipView == flipView) {
+ printf ("DEBUG: in draw position 0.1a\n");
/* If too much changes (begin observing new game, etc.), don't
do flashing */
do_flash = too_many_diffs(board, lastBoard) ? 0 : 1;
}
} else {
if (lineGap > 0)
- XDrawSegments(xDisplay, xBoardWindow, lineGC,
- gridSegments, BOARD_HEIGHT + BOARD_WIDTH + 2);
+ {
+ /* todo move GC to setupgc */
+ GdkGC *gtklineGC=NULL;
+ GdkColor tmp;
+
+ gtklineGC = gdk_gc_new(GDK_WINDOW(GUI_Board->window));
+
+ tmp.green=60000;
+ tmp.red=0;
+ tmp.blue=1234;
+ gdk_gc_set_rgb_fg_color(gtklineGC, &tmp);
+
+ tmp.green=60000;
+ tmp.red=60000;
+ tmp.blue=61234;
+ gdk_gc_set_rgb_bg_color(gtklineGC, &tmp);
+
+ gdk_draw_segments(GUI_Board->window,gtklineGC,
+ gridSegments, BOARD_HEIGHT + BOARD_WIDTH + 2 );
+ }
for (i = 0; i < BOARD_HEIGHT; i++)
for (j = 0; j < BOARD_WIDTH; j++) {
/* If piece being dragged around board, must redraw that too */
DrawDragPiece();
- XSync(xDisplay, False);
+ // XSync(xDisplay, False);
}
String *prms;
Cardinal *nprms;
{
- XDrawPosition(w, True, NULL);
+ DrawPosition(True, NULL);
}
char *title, *label;
int modal;
{
- Arg args[16];
- Widget dialog, layout;
- Position x, y;
- int xx, yy;
- Window junk;
- Dimension bw_width, pw_width;
- Dimension pw_height;
- int i;
-
- i = 0;
- XtSetArg(args[i], XtNresizable, True); i++;
- XtSetArg(args[i], XtNtitle, title); i++;
- errorShell =
- XtCreatePopupShell("errorpopup", transientShellWidgetClass,
- shellWidget, args, i);
- layout =
- XtCreateManagedWidget(layoutName, formWidgetClass, errorShell,
- layoutArgs, XtNumber(layoutArgs));
-
- i = 0;
- XtSetArg(args[i], XtNlabel, label); i++;
- XtSetArg(args[i], XtNborderWidth, 0); i++;
- dialog = XtCreateManagedWidget("dialog", dialogWidgetClass,
- layout, args, i);
-
- XawDialogAddButton(dialog, _("ok"), ErrorCallback, (XtPointer) dialog);
-
- XtRealizeWidget(errorShell);
- CatchDeleteWindow(errorShell, "ErrorPopDown");
-
- i = 0;
- XtSetArg(args[i], XtNwidth, &bw_width); i++;
- XtGetValues(boardWidget, args, i);
- i = 0;
- XtSetArg(args[i], XtNwidth, &pw_width); i++;
- XtSetArg(args[i], XtNheight, &pw_height); i++;
- XtGetValues(errorShell, args, i);
-
-#ifdef NOTDEF
- /* This code seems to tickle an X bug if it is executed too soon
- after xboard starts up. The coordinates get transformed as if
- the main window was positioned at (0, 0).
- */
- XtTranslateCoords(boardWidget, (bw_width - pw_width) / 2,
- 0 - pw_height + squareSize / 3, &x, &y);
-#else
- XTranslateCoordinates(xDisplay, XtWindow(boardWidget),
- RootWindowOfScreen(XtScreen(boardWidget)),
- (bw_width - pw_width) / 2,
- 0 - pw_height + squareSize / 3, &xx, &yy, &junk);
- x = xx;
- y = yy;
-#endif
- if (y < 0) y = 0; /*avoid positioning top offscreen*/
-
- i = 0;
- XtSetArg(args[i], XtNx, x); i++;
- XtSetArg(args[i], XtNy, y); i++;
- XtSetValues(errorShell, args, i);
-
- errorUp = True;
- XtPopup(errorShell, modal ? XtGrabExclusive : XtGrabNone);
+ GtkWidget *dialog;
+
+ printf ("DEBUG: error %s %s\n\n",title,label);
+
+ dialog = gtk_message_dialog_new(GTK_WINDOW(GUI_Window),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ (gchar *)label);
+
+ gtk_window_set_title(GTK_WINDOW(dialog),(gchar *) title);
+ if(modal)
+ {
+ gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_destroy(GTK_WIDGET(dialog));
+ }
+ else
+ {
+ g_signal_connect_swapped (dialog, "response",
+ G_CALLBACK (ErrorPopDownProc),
+ dialog);
+ errorUp = True;
+ gtk_widget_show(GTK_WIDGET(dialog));
+ }
}
/* Disable all user input other than deleting the window */
{
if (frozen) return;
/* Grab by a widget that doesn't accept input */
- XtAddGrab(messageWidget, TRUE, FALSE);
+ // XtAddGrab(messageWidget, TRUE, FALSE);
frozen = 1;
}
/*
* Button/menu procedures
*/
-void ResetProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
-{
- ResetGameEvent();
- AnalysisPopDown();
-}
int LoadGamePopUp(f, gameNumber, title)
FILE *f;
return LoadGame(f, gameNumber, title, FALSE);
}
-void LoadGameProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
-{
- if (gameMode == AnalyzeMode || gameMode == AnalyzeFile) {
- Reset(FALSE, TRUE);
- }
- FileNamePopUp(_("Load game file name?"), "", LoadGamePopUp, "rb");
-}
-
-void LoadNextGameProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
-{
- ReloadGame(1);
-}
-
-void LoadPrevGameProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
-{
- ReloadGame(-1);
-}
-
-void ReloadGameProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
-{
- ReloadGame(0);
-}
void LoadNextPositionProc(w, event, prms, nprms)
Widget w;
SaveGameProc(NULL, NULL, NULL, NULL);
}
-
-void QuitProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
-{
- ExitEvent(0);
-}
-
-void PauseProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
-{
- PauseEvent();
-}
-
-
void MachineBlackProc(w, event, prms, nprms)
Widget w;
XEvent *event;
args, 1);
}
-void ShowCoordsProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
-{
- Arg args[16];
-
- appData.showCoords = !appData.showCoords;
-
- if (appData.showCoords) {
- XtSetArg(args[0], XtNleftBitmap, xMarkPixmap);
- } else {
- XtSetArg(args[0], XtNleftBitmap, None);
- }
- XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.Show Coords"),
- args, 1);
-
- DrawPosition(True, NULL);
-}
-
void ShowThinkingProc(w, event, prms, nprms)
Widget w;
XEvent *event;
BookEvent();
}
-void AboutProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
-{
- char buf[MSG_SIZ];
-#if ZIPPY
- char *zippy = " (with Zippy code)";
-#else
- char *zippy = "";
-#endif
- snprintf(buf, sizeof(buf), "%s%s\n\n%s\n%s\n%s\n\n%s%s\n%s",
- programVersion, zippy,
- "Copyright 1991 Digital Equipment Corporation",
- "Enhancements Copyright 1992-2009 Free Software Foundation",
- "Enhancements Copyright 2005 Alessandro Scotti",
- PACKAGE, " is free software and carries NO WARRANTY;",
- "see the file COPYING for more information.");
- ErrorPopUp(_("About XBoard"), buf, FALSE);
-}
-
void DebugProc(w, event, prms, nprms)
Widget w;
XEvent *event;
}
void DisplayMessage(message, extMessage)
- char *message, *extMessage;
+ gchar *message, *extMessage;
{
char buf[MSG_SIZ];
Arg arg;
message = extMessage;
}
}
- XtSetArg(arg, XtNlabel, message);
- XtSetValues(messageWidget, &arg, 1);
+
+ printf("TODO: message %s\n",message);
+ gtk_label_set_text( GTK_LABEL(gtk_builder_get_object (builder, "Messages")),message);
}
void DisplayTitle(text)
void
DisplayTimerLabel(w, color, timer, highlight)
- Widget w;
+ GtkWidget *w;
char *color;
long timer;
int highlight;
{
- char buf[MSG_SIZ];
- Arg args[16];
-
- /* check for low time warning */
- Pixel foregroundOrWarningColor = timerForegroundPixel;
-
- if (timer > 0 &&
- appData.lowTimeWarning &&
- (timer / 1000) < appData.icsAlarmTime)
- foregroundOrWarningColor = lowTimeWarningColor;
-
- if (appData.clockMode) {
- sprintf(buf, "%s: %s", color, TimeString(timer));
- XtSetArg(args[0], XtNlabel, buf);
- } else {
- sprintf(buf, "%s ", color);
- XtSetArg(args[0], XtNlabel, buf);
- }
-
- if (highlight) {
-
- XtSetArg(args[1], XtNbackground, foregroundOrWarningColor);
- XtSetArg(args[2], XtNforeground, timerBackgroundPixel);
- } else {
- XtSetArg(args[1], XtNbackground, timerBackgroundPixel);
- XtSetArg(args[2], XtNforeground, foregroundOrWarningColor);
- }
-
- XtSetValues(w, args, 3);
+ gchar buf[MSG_SIZ];
+
+
+ if (appData.clockMode) {
+ sprintf(buf, "%s: %s", color, TimeString(timer));
+ } else {
+ sprintf(buf, "%s ", color);
+ }
+ gtk_label_set_text(GTK_LABEL(w),buf);
+
+ /* check for low time warning */
+// Pixel foregroundOrWarningColor = timerForegroundPixel;
+
+// if (timer > 0 &&
+// appData.lowTimeWarning &&
+// (timer / 1000) < appData.icsAlarmTime)
+// foregroundOrWarningColor = lowTimeWarningColor;
+//
+// if (appData.clockMode) {
+// sprintf(buf, "%s: %s", color, TimeString(timer));
+// XtSetArg(args[0], XtNlabel, buf);
+// } else {
+// sprintf(buf, "%s ", color);
+// XtSetArg(args[0], XtNlabel, buf);
+// }
+//
+// if (highlight) {
+//
+// XtSetArg(args[1], XtNbackground, foregroundOrWarningColor);
+// XtSetArg(args[2], XtNforeground, timerBackgroundPixel);
+// } else {
+// XtSetArg(args[1], XtNbackground, timerBackgroundPixel);
+// XtSetArg(args[2], XtNforeground, foregroundOrWarningColor);
+// }
+//
+// XtSetValues(w, args, 3);
+//
}
void
long timeRemaining;
int highlight;
{
- Arg args[16];
+ if(appData.noGUI) return;
- if(appData.noGUI) return;
- DisplayTimerLabel(whiteTimerWidget, _("White"), timeRemaining, highlight);
- if (highlight && iconPixmap == bIconPixmap) {
- iconPixmap = wIconPixmap;
- XtSetArg(args[0], XtNiconPixmap, iconPixmap);
- XtSetValues(shellWidget, args, 1);
- }
+ DisplayTimerLabel(GUI_Whiteclock, _("White"), timeRemaining, highlight);
+ if (highlight && WindowIcon == BlackIcon) {
+ WindowIcon = WhiteIcon;
+ gtk_window_set_icon(GTK_WINDOW(GUI_Window),WindowIcon);
+ }
}
void
long timeRemaining;
int highlight;
{
- Arg args[16];
-
if(appData.noGUI) return;
- DisplayTimerLabel(blackTimerWidget, _("Black"), timeRemaining, highlight);
- if (highlight && iconPixmap == wIconPixmap) {
- iconPixmap = bIconPixmap;
- XtSetArg(args[0], XtNiconPixmap, iconPixmap);
- XtSetValues(shellWidget, args, 1);
+ DisplayTimerLabel(GUI_Blackclock, _("Black"), timeRemaining, highlight);
+ if (highlight && WindowIcon == WhiteIcon) {
+ WindowIcon = BlackIcon;
+ gtk_window_set_icon(GTK_WINDOW(GUI_Window),WindowIcon);
}
}
if (xpmDone && gameInfo.variant == old) return;
if(xpmDone) old = gameInfo.variant; // first time pieces might not be created yet
- XGetWindowAttributes(xDisplay, xBoardWindow, &info);
+ // XGetWindowAttributes(xDisplay, xBoardWindow, &info);
InitAnimState(&game, &info);
InitAnimState(&player, &info);
damage[toY][toX] = True;
}
-static void
+void
DragPieceBegin(x, y)
int x; int y;
{
#endif
}
-static void
+void
DragPieceEnd(x, y)
int x; int y;
{