More intmax_t removal.

This commit is contained in:
Pietro Gagliardi 2016-06-13 21:05:40 -04:00
parent 8d48d42201
commit 440635447d
11 changed files with 36 additions and 37 deletions

View File

@ -381,7 +381,7 @@ int sendAreaEvents(NSEvent *e)
return 0; return 0;
} }
void uiAreaSetSize(uiArea *a, intmax_t width, intmax_t height) void uiAreaSetSize(uiArea *a, int width, int height)
{ {
if (!a->scrolling) if (!a->scrolling)
userbug("You cannot call uiAreaSetSize() on a non-scrolling uiArea. (area: %p)", a); userbug("You cannot call uiAreaSetSize() on a non-scrolling uiArea. (area: %p)", a);
@ -417,7 +417,7 @@ uiArea *uiNewArea(uiAreaHandler *ah)
return a; return a;
} }
uiArea *uiNewScrollingArea(uiAreaHandler *ah, intmax_t width, intmax_t height) uiArea *uiNewScrollingArea(uiAreaHandler *ah, int width, int height)
{ {
uiArea *a; uiArea *a;
struct scrollViewCreateParams p; struct scrollViewCreateParams p;

View File

@ -81,12 +81,12 @@ void uiComboboxAppend(uiCombobox *c, const char *text)
[c->pbac addObject:toNSString(text)]; [c->pbac addObject:toNSString(text)];
} }
intmax_t uiComboboxSelected(uiCombobox *c) int uiComboboxSelected(uiCombobox *c)
{ {
return [c->pb indexOfSelectedItem]; return [c->pb indexOfSelectedItem];
} }
void uiComboboxSetSelected(uiCombobox *c, intmax_t n) void uiComboboxSetSelected(uiCombobox *c, int n)
{ {
[c->pb selectItemAtIndex:n]; [c->pb selectItemAtIndex:n];
} }

View File

@ -74,7 +74,7 @@ static void uiRadioButtonsDestroy(uiControl *c)
uiFreeControl(uiControl(r)); uiFreeControl(uiControl(r));
} }
static NSButton *buttonAt(uiRadioButtons *r, uintmax_t n) static NSButton *buttonAt(uiRadioButtons *r, int n)
{ {
return (NSButton *) [r->buttons objectAtIndex:n]; return (NSButton *) [r->buttons objectAtIndex:n];
} }
@ -152,7 +152,7 @@ void uiRadioButtonsAppend(uiRadioButtons *r, const char *text)
[r->lastv retain]; [r->lastv retain];
} }
intmax_t uiRadioButtonsSelected(uiRadioButtons *r) int uiRadioButtonsSelected(uiRadioButtons *r)
{ {
NSButton *b; NSButton *b;
NSUInteger i; NSUInteger i;
@ -165,7 +165,7 @@ intmax_t uiRadioButtonsSelected(uiRadioButtons *r)
return -1; return -1;
} }
void uiRadioButtonsSetSelected(uiRadioButtons *r, intmax_t n) void uiRadioButtonsSetSelected(uiRadioButtons *r, int n)
{ {
NSButton *b; NSButton *b;
NSInteger state; NSInteger state;

12
ui.h
View File

@ -198,8 +198,8 @@ _UI_EXTERN uiSeparator *uiNewHorizontalSeparator(void);
typedef struct uiCombobox uiCombobox; typedef struct uiCombobox uiCombobox;
#define uiCombobox(this) ((uiCombobox *) (this)) #define uiCombobox(this) ((uiCombobox *) (this))
_UI_EXTERN void uiComboboxAppend(uiCombobox *c, const char *text); _UI_EXTERN void uiComboboxAppend(uiCombobox *c, const char *text);
_UI_EXTERN intmax_t uiComboboxSelected(uiCombobox *c); _UI_EXTERN int uiComboboxSelected(uiCombobox *c);
_UI_EXTERN void uiComboboxSetSelected(uiCombobox *c, intmax_t n); _UI_EXTERN void uiComboboxSetSelected(uiCombobox *c, int n);
_UI_EXTERN void uiComboboxOnSelected(uiCombobox *c, void (*f)(uiCombobox *c, void *data), void *data); _UI_EXTERN void uiComboboxOnSelected(uiCombobox *c, void (*f)(uiCombobox *c, void *data), void *data);
_UI_EXTERN uiCombobox *uiNewCombobox(void); _UI_EXTERN uiCombobox *uiNewCombobox(void);
@ -215,8 +215,8 @@ _UI_EXTERN uiEditableCombobox *uiNewEditableCombobox(void);
typedef struct uiRadioButtons uiRadioButtons; typedef struct uiRadioButtons uiRadioButtons;
#define uiRadioButtons(this) ((uiRadioButtons *) (this)) #define uiRadioButtons(this) ((uiRadioButtons *) (this))
_UI_EXTERN void uiRadioButtonsAppend(uiRadioButtons *r, const char *text); _UI_EXTERN void uiRadioButtonsAppend(uiRadioButtons *r, const char *text);
_UI_EXTERN intmax_t uiRadioButtonsSelected(uiRadioButtons *r); _UI_EXTERN int uiRadioButtonsSelected(uiRadioButtons *r);
_UI_EXTERN void uiRadioButtonsSetSelected(uiRadioButtons *r, intmax_t n); _UI_EXTERN void uiRadioButtonsSetSelected(uiRadioButtons *r, int n);
_UI_EXTERN void uiRadioButtonsOnSelected(uiRadioButtons *r, void (*f)(uiRadioButtons *, void *), void *data); _UI_EXTERN void uiRadioButtonsOnSelected(uiRadioButtons *r, void (*f)(uiRadioButtons *, void *), void *data);
_UI_EXTERN uiRadioButtons *uiNewRadioButtons(void); _UI_EXTERN uiRadioButtons *uiNewRadioButtons(void);
@ -283,12 +283,12 @@ struct uiAreaHandler {
#define uiArea(this) ((uiArea *) (this)) #define uiArea(this) ((uiArea *) (this))
// TODO give a better name // TODO give a better name
// TODO document the types of width and height // TODO document the types of width and height
_UI_EXTERN void uiAreaSetSize(uiArea *a, intmax_t width, intmax_t height); _UI_EXTERN void uiAreaSetSize(uiArea *a, int width, int height);
// TODO uiAreaQueueRedraw() // TODO uiAreaQueueRedraw()
_UI_EXTERN void uiAreaQueueRedrawAll(uiArea *a); _UI_EXTERN void uiAreaQueueRedrawAll(uiArea *a);
_UI_EXTERN void uiAreaScrollTo(uiArea *a, double x, double y, double width, double height); _UI_EXTERN void uiAreaScrollTo(uiArea *a, double x, double y, double width, double height);
_UI_EXTERN uiArea *uiNewArea(uiAreaHandler *ah); _UI_EXTERN uiArea *uiNewArea(uiAreaHandler *ah);
_UI_EXTERN uiArea *uiNewScrollingArea(uiAreaHandler *ah, intmax_t width, intmax_t height); _UI_EXTERN uiArea *uiNewScrollingArea(uiAreaHandler *ah, int width, int height);
struct uiAreaDrawParams { struct uiAreaDrawParams {
uiDrawContext *Context; uiDrawContext *Context;

View File

@ -41,8 +41,8 @@ struct uiArea {
uiAreaHandler *ah; uiAreaHandler *ah;
gboolean scrolling; gboolean scrolling;
intmax_t scrollWidth; int scrollWidth;
intmax_t scrollHeight; int scrollHeight;
// note that this is a pointer; see above // note that this is a pointer; see above
clickCounter *cc; clickCounter *cc;
@ -482,7 +482,7 @@ static void areaWidget_class_init(areaWidgetClass *class)
uiUnixControlAllDefaults(uiArea) uiUnixControlAllDefaults(uiArea)
void uiAreaSetSize(uiArea *a, intmax_t width, intmax_t height) void uiAreaSetSize(uiArea *a, int width, int height)
{ {
if (!a->scrolling) if (!a->scrolling)
userbug("You cannot call uiAreaSetSize() on a non-scrolling uiArea. (area: %p)", a); userbug("You cannot call uiAreaSetSize() on a non-scrolling uiArea. (area: %p)", a);
@ -522,7 +522,7 @@ uiArea *uiNewArea(uiAreaHandler *ah)
return a; return a;
} }
uiArea *uiNewScrollingArea(uiAreaHandler *ah, intmax_t width, intmax_t height) uiArea *uiNewScrollingArea(uiAreaHandler *ah, int width, int height)
{ {
uiArea *a; uiArea *a;

View File

@ -30,12 +30,12 @@ void uiComboboxAppend(uiCombobox *c, const char *text)
gtk_combo_box_text_append(c->comboboxText, NULL, text); gtk_combo_box_text_append(c->comboboxText, NULL, text);
} }
intmax_t uiComboboxSelected(uiCombobox *c) int uiComboboxSelected(uiCombobox *c)
{ {
return gtk_combo_box_get_active(c->combobox); return gtk_combo_box_get_active(c->combobox);
} }
void uiComboboxSetSelected(uiCombobox *c, intmax_t n) void uiComboboxSetSelected(uiCombobox *c, int n)
{ {
// we need to inhibit sending of ::changed because this WILL send a ::changed otherwise // we need to inhibit sending of ::changed because this WILL send a ::changed otherwise
g_signal_handler_block(c->combobox, c->onSelectedSignal); g_signal_handler_block(c->combobox, c->onSelectedSignal);

View File

@ -64,7 +64,7 @@ void uiRadioButtonsAppend(uiRadioButtons *r, const char *text)
gtk_widget_show(rb); gtk_widget_show(rb);
} }
intmax_t uiRadioButtonsSelected(uiRadioButtons *r) int uiRadioButtonsSelected(uiRadioButtons *r)
{ {
GtkToggleButton *tb; GtkToggleButton *tb;
guint i; guint i;
@ -77,7 +77,7 @@ intmax_t uiRadioButtonsSelected(uiRadioButtons *r)
return -1; return -1;
} }
void uiRadioButtonsSetSelected(uiRadioButtons *r, intmax_t n) void uiRadioButtonsSetSelected(uiRadioButtons *r, int n)
{ {
GtkToggleButton *tb; GtkToggleButton *tb;
gboolean active; gboolean active;

View File

@ -51,7 +51,7 @@ static LRESULT CALLBACK areaWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
uiWindowsControlAllDefaults(uiArea) uiWindowsControlAllDefaults(uiArea)
static void uiAreaMinimumSize(uiWindowsControl *c, intmax_t *width, intmax_t *height) static void uiAreaMinimumSize(uiWindowsControl *c, int *width, int *height)
{ {
// TODO // TODO
*width = 0; *width = 0;
@ -80,7 +80,7 @@ void unregisterArea(void)
logLastError(L"error unregistering uiArea window class"); logLastError(L"error unregistering uiArea window class");
} }
void uiAreaSetSize(uiArea *a, intmax_t width, intmax_t height) void uiAreaSetSize(uiArea *a, int width, int height)
{ {
a->scrollWidth = width; a->scrollWidth = width;
a->scrollHeight = height; a->scrollHeight = height;
@ -118,7 +118,7 @@ uiArea *uiNewArea(uiAreaHandler *ah)
return a; return a;
} }
uiArea *uiNewScrollingArea(uiAreaHandler *ah, intmax_t width, intmax_t height) uiArea *uiNewScrollingArea(uiAreaHandler *ah, int width, int height)
{ {
uiArea *a; uiArea *a;

View File

@ -11,8 +11,8 @@ struct uiArea {
uiAreaHandler *ah; uiAreaHandler *ah;
BOOL scrolling; BOOL scrolling;
intmax_t scrollWidth; int scrollWidth;
intmax_t scrollHeight; int scrollHeight;
intmax_t hscrollpos; intmax_t hscrollpos;
intmax_t vscrollpos; intmax_t vscrollpos;
int hwheelCarry; int hwheelCarry;

View File

@ -36,7 +36,7 @@ uiWindowsControlAllDefaultsExceptDestroy(uiCombobox)
#define comboboxWidth 107 /* this is actually the shorter progress bar width, but Microsoft only indicates as wide as necessary; LONGTERM */ #define comboboxWidth 107 /* this is actually the shorter progress bar width, but Microsoft only indicates as wide as necessary; LONGTERM */
#define comboboxHeight 14 /* LONGTERM: is this too high? */ #define comboboxHeight 14 /* LONGTERM: is this too high? */
static void uiComboboxMinimumSize(uiWindowsControl *cc, intmax_t *width, intmax_t *height) static void uiComboboxMinimumSize(uiWindowsControl *cc, int *width, int *height)
{ {
uiCombobox *c = uiCombobox(cc); uiCombobox *c = uiCombobox(cc);
uiWindowsSizing sizing; uiWindowsSizing sizing;
@ -69,17 +69,17 @@ void uiComboboxAppend(uiCombobox *c, const char *text)
uiFree(wtext); uiFree(wtext);
} }
intmax_t uiComboboxSelected(uiCombobox *c) int uiComboboxSelected(uiCombobox *c)
{ {
LRESULT n; LRESULT n;
n = SendMessage(c->hwnd, CB_GETCURSEL, 0, 0); n = SendMessage(c->hwnd, CB_GETCURSEL, 0, 0);
if (n == (LRESULT) CB_ERR) if (n == (LRESULT) CB_ERR)
return -1; return -1;
return (intmax_t) n; return n;
} }
void uiComboboxSetSelected(uiCombobox *c, intmax_t n) void uiComboboxSetSelected(uiCombobox *c, int n)
{ {
// TODO error check // TODO error check
SendMessageW(c->hwnd, CB_SETCURSEL, (WPARAM) n, 0); SendMessageW(c->hwnd, CB_SETCURSEL, (WPARAM) n, 0);

View File

@ -20,7 +20,6 @@ static BOOL onWM_COMMAND(uiControl *c, HWND clicked, WORD code, LRESULT *lResult
{ {
uiRadioButtons *r = uiRadioButtons(c); uiRadioButtons *r = uiRadioButtons(c);
WPARAM check; WPARAM check;
uintmax_t i;
if (code != BN_CLICKED) if (code != BN_CLICKED)
return FALSE; return FALSE;
@ -61,10 +60,10 @@ uiWindowsControlAllDefaultsExceptDestroy(uiRadioButtons)
// from http://msdn.microsoft.com/en-us/library/windows/desktop/bb226818%28v=vs.85%29.aspx // from http://msdn.microsoft.com/en-us/library/windows/desktop/bb226818%28v=vs.85%29.aspx
#define radiobuttonXFromLeftOfBoxToLeftOfLabel 12 #define radiobuttonXFromLeftOfBoxToLeftOfLabel 12
static void uiRadioButtonsMinimumSize(uiWindowsControl *c, intmax_t *width, intmax_t *height) static void uiRadioButtonsMinimumSize(uiWindowsControl *c, int *width, int *height)
{ {
uiRadioButtons *r = uiRadioButtons(c); uiRadioButtons *r = uiRadioButtons(c);
intmax_t wid, maxwid; int wid, maxwid;
uiWindowsSizing sizing; uiWindowsSizing sizing;
int x, y; int x, y;
@ -92,7 +91,7 @@ static void uiRadioButtonsMinimumSize(uiWindowsControl *c, intmax_t *width, intm
static void radiobuttonsRelayout(uiRadioButtons *r) static void radiobuttonsRelayout(uiRadioButtons *r)
{ {
RECT client; RECT client;
intmax_t x, y, width, height; int x, y, width, height;
int height1; int height1;
uiWindowsSizing sizing; uiWindowsSizing sizing;
@ -149,7 +148,7 @@ void uiRadioButtonsAppend(uiRadioButtons *r, const char *text)
uiWindowsControlMinimumSizeChanged(uiWindowsControl(r)); uiWindowsControlMinimumSizeChanged(uiWindowsControl(r));
} }
intmax_t uiRadioButtonsSelected(uiRadioButtons *r) int uiRadioButtonsSelected(uiRadioButtons *r)
{ {
size_t i; size_t i;
@ -159,9 +158,9 @@ intmax_t uiRadioButtonsSelected(uiRadioButtons *r)
return -1; return -1;
} }
void uiRadioButtonsSetSelected(uiRadioButtons *r, intmax_t n) void uiRadioButtonsSetSelected(uiRadioButtons *r, int n)
{ {
intmax_t m; int m;
m = uiRadioButtonsSelected(r); m = uiRadioButtonsSelected(r);
if (m != -1) if (m != -1)