Remove useless whitespaces.

This commit is contained in:
Jonathan Schleifer 2012-01-05 16:42:11 +01:00
parent c29f0c525c
commit 65818a08da
9 changed files with 50 additions and 50 deletions

View file

@ -19,7 +19,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
//================================================================================================================================== //==================================================================================================================================
// OGApplication.m // OGApplication.m
//================================================================================================================================== //==================================================================================================================================
@ -89,7 +89,7 @@ void win32_init(int *argc, char ***argv)
wcx.lpszMenuName = NULL; wcx.lpszMenuName = NULL;
wcx.lpszClassName = clsName; wcx.lpszClassName = clsName;
wcx.hIconSm = NULL; wcx.hIconSm = NULL;
RegisterClassEx(&wcx); RegisterClassEx(&wcx);
//TODO: although this doesn't ever really fail, we should probably Throw an Exception here... //TODO: although this doesn't ever really fail, we should probably Throw an Exception here...
//if(!RegisterClassEx(&wcx)) @throw ...; //if(!RegisterClassEx(&wcx)) @throw ...;
@ -113,7 +113,7 @@ void win32_main()
LRESULT CALLBACK win32_OGWndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) LRESULT CALLBACK win32_OGWndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{ {
void *ptr = (void *)GetWindowLong(hwnd, GWL_USERDATA); void *ptr = (void *)GetWindowLong(hwnd, GWL_USERDATA);
if(ptr == NULL) return DefWindowProc(hwnd, msg, wparam, lparam); if(ptr == NULL) return DefWindowProc(hwnd, msg, wparam, lparam);
return [(id)ptr MessageReceived : hwnd : msg : wparam : lparam]; return [(id)ptr MessageReceived : hwnd : msg : wparam : lparam];
} }
//================================================================================================================================== //==================================================================================================================================

View file

@ -20,7 +20,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
//================================================================================================================================== //==================================================================================================================================
// OGBox.m // OGBox.m
//================================================================================================================================== //==================================================================================================================================
@ -81,7 +81,7 @@
- (int)MessageReceived : (HWND)hwnd : (UINT)msg : (WPARAM)wparam : (LPARAM)lparam - (int)MessageReceived : (HWND)hwnd : (UINT)msg : (WPARAM)wparam : (LPARAM)lparam
{ {
HWND parent; HWND parent;
switch(msg) switch(msg)
{ {
case WM_COMMAND: case WM_COMMAND:

View file

@ -19,7 +19,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
//================================================================================================================================== //==================================================================================================================================
// OGButton.m // OGButton.m
//================================================================================================================================== //==================================================================================================================================
@ -54,7 +54,7 @@ static void CH_Command(id object, WPARAM wparam)
- init - init
{ {
self = [super init]; self = [super init];
//we're specifying a different class name... //we're specifying a different class name...
//so we'll have to discard the default OGWidget HWND... //so we'll have to discard the default OGWidget HWND...
DestroyWindow(widget); DestroyWindow(widget);
@ -63,7 +63,7 @@ static void CH_Command(id object, WPARAM wparam)
HINSTANCE hInst = (HINSTANCE)GetModuleHandle(NULL); HINSTANCE hInst = (HINSTANCE)GetModuleHandle(NULL);
widget = CreateWindow("button", "", BS_PUSHBUTTON, widget = CreateWindow("button", "", BS_PUSHBUTTON,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, hInst, NULL); NULL, NULL, hInst, NULL);
SetWindowLong(widget, GWL_STYLE, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP); SetWindowLong(widget, GWL_STYLE, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP);
//crazy workaround since we don't have control of our WNDPROC for default "button"s //crazy workaround since we don't have control of our WNDPROC for default "button"s
CommandHandlerData *chd = (CommandHandlerData *)malloc(sizeof(CommandHandlerData)); CommandHandlerData *chd = (CommandHandlerData *)malloc(sizeof(CommandHandlerData));
@ -82,7 +82,7 @@ static void CH_Command(id object, WPARAM wparam)
int tlen = GetWindowTextLength(widget); int tlen = GetWindowTextLength(widget);
char *buff = (char *)malloc(tlen + 1); char *buff = (char *)malloc(tlen + 1);
GetWindowText(widget, buff, tlen+1); GetWindowText(widget, buff, tlen+1);
OFString *ret = [OFString stringWithUTF8String : buff]; OFString *ret = [OFString stringWithUTF8String : buff];
free(buff); free(buff);
return ret; return ret;

View file

@ -61,13 +61,13 @@ static void CH_Command(id object, WPARAM wparam)
HINSTANCE hInst = (HINSTANCE)GetModuleHandle(NULL); HINSTANCE hInst = (HINSTANCE)GetModuleHandle(NULL);
widget = CreateWindow("LISTBOX", "", LBS_NOINTEGRALHEIGHT, widget = CreateWindow("LISTBOX", "", LBS_NOINTEGRALHEIGHT,
0, 0, 32, 32, 0, 0, 32, 32,
NULL, NULL, hInst, NULL); NULL, NULL, hInst, NULL);
SetWindowLong(widget, GWL_STYLE, LBS_NOINTEGRALHEIGHT | LBS_NOTIFY | WS_CHILD | WS_VISIBLE | WS_TABSTOP); SetWindowLong(widget, GWL_STYLE, LBS_NOINTEGRALHEIGHT | LBS_NOTIFY | WS_CHILD | WS_VISIBLE | WS_TABSTOP);
CommandHandlerData *chd = (CommandHandlerData *)malloc(sizeof(CommandHandlerData)); CommandHandlerData *chd = (CommandHandlerData *)malloc(sizeof(CommandHandlerData));
chd->funct = CH_Command; chd->funct = CH_Command;
chd->object = self; chd->object = self;
SetProp(widget, "CommandHandlerData", chd); SetProp(widget, "CommandHandlerData", chd);
[self retain]; [self retain];
return self; return self;
} }
@ -82,12 +82,12 @@ static void CH_Command(id object, WPARAM wparam)
HINSTANCE hInst = (HINSTANCE)GetModuleHandle(NULL); HINSTANCE hInst = (HINSTANCE)GetModuleHandle(NULL);
widget = CreateWindow("LISTBOX", "", LBS_NOINTEGRALHEIGHT | LBS_NOTIFY | WS_CHILD | WS_VISIBLE, widget = CreateWindow("LISTBOX", "", LBS_NOINTEGRALHEIGHT | LBS_NOTIFY | WS_CHILD | WS_VISIBLE,
0, 0, 32, 32, 0, 0, 32, 32,
parent->widget, NULL, hInst, NULL); parent->widget, NULL, hInst, NULL);
CommandHandlerData *chd = (CommandHandlerData *)malloc(sizeof(CommandHandlerData)); CommandHandlerData *chd = (CommandHandlerData *)malloc(sizeof(CommandHandlerData));
chd->funct = CH_Command; chd->funct = CH_Command;
chd->object = self; chd->object = self;
SetProp(widget, "CommandHandlerData", chd); SetProp(widget, "CommandHandlerData", chd);
[self retain]; [self retain];
return self; return self;
} }
@ -110,7 +110,7 @@ static void CH_Command(id object, WPARAM wparam)
{ {
OGComboBoxItem *item = itemAtIndex(dataSource, OGComboBoxItem *item = itemAtIndex(dataSource,
@selector(comboBox:itemAtIndex:), self, i); @selector(comboBox:itemAtIndex:), self, i);
SendMessage(widget, LB_ADDSTRING, 0, (WPARAM)[item.label UTF8String]); SendMessage(widget, LB_ADDSTRING, 0, (WPARAM)[item.label UTF8String]);
} }
} }

View file

@ -44,7 +44,7 @@
RECT rc; RECT rc;
SetParent(child->widget, widget); SetParent(child->widget, widget);
GetWindowRect(child->widget, &rc); GetWindowRect(child->widget, &rc);
og_box_child_t *newChild = malloc(sizeof(og_box_child_t)); og_box_child_t *newChild = malloc(sizeof(og_box_child_t));
newChild->hwnd = child->widget; newChild->hwnd = child->widget;
newChild->expand = expand; newChild->expand = expand;
@ -53,7 +53,7 @@
newChild->originalSize = (rc.right - rc.left); newChild->originalSize = (rc.right - rc.left);
newChild->currentSize = (float)(newChild->originalSize + (newChild->padding << 1)); newChild->currentSize = (float)(newChild->originalSize + (newChild->padding << 1));
newChild->next = NULL; newChild->next = NULL;
if(firstBorn == NULL) if(firstBorn == NULL)
firstBorn = newChild; firstBorn = newChild;
else else
@ -62,7 +62,7 @@
while(curr->next != NULL) curr = curr->next; while(curr->next != NULL) curr = curr->next;
curr->next = newChild; curr->next = newChild;
} }
[self OG_resizeChildren]; [self OG_resizeChildren];
} }
//---------------------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------------------
@ -74,7 +74,7 @@
RECT rc; RECT rc;
SetParent(child->widget, widget); SetParent(child->widget, widget);
GetWindowRect(child->widget, &rc); GetWindowRect(child->widget, &rc);
og_box_child_t *newChild = malloc(sizeof(og_box_child_t)); og_box_child_t *newChild = malloc(sizeof(og_box_child_t));
newChild->hwnd = child->widget; newChild->hwnd = child->widget;
newChild->expand = expand; newChild->expand = expand;
@ -83,9 +83,9 @@
newChild->originalSize = (rc.right - rc.left); newChild->originalSize = (rc.right - rc.left);
newChild->currentSize = (float)(newChild->originalSize + (newChild->padding << 1)); newChild->currentSize = (float)(newChild->originalSize + (newChild->padding << 1));
newChild->next = firstBorn; newChild->next = firstBorn;
firstBorn = newChild; firstBorn = newChild;
[self OG_resizeChildren]; [self OG_resizeChildren];
} }
//---------------------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------------------
@ -93,12 +93,12 @@
{ {
RECT rc; RECT rc;
og_box_child_t *curr; og_box_child_t *curr;
//get our available size //get our available size
GetClientRect(widget, &rc); GetClientRect(widget, &rc);
int width = rc.right; int width = rc.right;
int height = rc.bottom; int height = rc.bottom;
//get total of childrens' widths //get total of childrens' widths
int childOriginal = 0; int childOriginal = 0;
curr = firstBorn; curr = firstBorn;
@ -107,11 +107,11 @@
childOriginal += (curr->originalSize + (curr->padding << 1)); childOriginal += (curr->originalSize + (curr->padding << 1));
curr = curr->next; curr = curr->next;
} }
//how to divide our extra space //how to divide our extra space
int extra = width - childOriginal; int extra = width - childOriginal;
float evenShare = 0.0f; float evenShare = 0.0f;
if(extra <= 0) if(extra <= 0)
{ {
curr = firstBorn; curr = firstBorn;
@ -151,7 +151,7 @@
} }
} }
} }
//assign new positions/heights //assign new positions/heights
float x = 0.0f; float x = 0.0f;
curr = firstBorn; curr = firstBorn;
@ -174,7 +174,7 @@
[self OG_resizeChildren]; [self OG_resizeChildren];
return DefWindowProc(hwnd, msg, wparam, lparam); return DefWindowProc(hwnd, msg, wparam, lparam);
break; break;
case WM_SIZING: case WM_SIZING:
[self OG_resizeChildren]; [self OG_resizeChildren];
return DefWindowProc(hwnd, msg, wparam, lparam); return DefWindowProc(hwnd, msg, wparam, lparam);

View file

@ -44,7 +44,7 @@
RECT rc; RECT rc;
SetParent(child->widget, widget); SetParent(child->widget, widget);
GetWindowRect(child->widget, &rc); GetWindowRect(child->widget, &rc);
og_box_child_t *newChild = malloc(sizeof(og_box_child_t)); og_box_child_t *newChild = malloc(sizeof(og_box_child_t));
newChild->hwnd = child->widget; newChild->hwnd = child->widget;
newChild->expand = expand; newChild->expand = expand;
@ -53,7 +53,7 @@
newChild->originalSize = (rc.bottom - rc.top); newChild->originalSize = (rc.bottom - rc.top);
newChild->currentSize = (float)(newChild->originalSize + (newChild->padding << 1)); newChild->currentSize = (float)(newChild->originalSize + (newChild->padding << 1));
newChild->next = NULL; newChild->next = NULL;
if(firstBorn == NULL) if(firstBorn == NULL)
firstBorn = newChild; firstBorn = newChild;
else else
@ -62,7 +62,7 @@
while(curr->next != NULL) curr = curr->next; while(curr->next != NULL) curr = curr->next;
curr->next = newChild; curr->next = newChild;
} }
[self OG_resizeChildren]; [self OG_resizeChildren];
} }
//---------------------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------------------
@ -74,7 +74,7 @@
RECT rc; RECT rc;
SetParent(child->widget, widget); SetParent(child->widget, widget);
GetWindowRect(child->widget, &rc); GetWindowRect(child->widget, &rc);
og_box_child_t *newChild = malloc(sizeof(og_box_child_t)); og_box_child_t *newChild = malloc(sizeof(og_box_child_t));
newChild->hwnd = child->widget; newChild->hwnd = child->widget;
newChild->expand = expand; newChild->expand = expand;
@ -83,9 +83,9 @@
newChild->originalSize = (rc.bottom - rc.top); newChild->originalSize = (rc.bottom - rc.top);
newChild->currentSize = (float)(newChild->originalSize + (newChild->padding << 1)); newChild->currentSize = (float)(newChild->originalSize + (newChild->padding << 1));
newChild->next = firstBorn; newChild->next = firstBorn;
firstBorn = newChild; firstBorn = newChild;
SetParent(child->widget, widget); SetParent(child->widget, widget);
[self OG_resizeChildren]; [self OG_resizeChildren];
} }
@ -94,12 +94,12 @@
{ {
RECT rc; RECT rc;
og_box_child_t *curr; og_box_child_t *curr;
//get our available size //get our available size
GetClientRect(widget, &rc); GetClientRect(widget, &rc);
int width = rc.right; int width = rc.right;
int height = rc.bottom; int height = rc.bottom;
//get total of childrens' heights //get total of childrens' heights
int childOriginal = 0; int childOriginal = 0;
curr = firstBorn; curr = firstBorn;
@ -108,11 +108,11 @@
childOriginal += (curr->originalSize + (curr->padding << 1)); childOriginal += (curr->originalSize + (curr->padding << 1));
curr = curr->next; curr = curr->next;
} }
//how to divide our extra space //how to divide our extra space
int extra = height - childOriginal; int extra = height - childOriginal;
float evenShare = 0.0f; float evenShare = 0.0f;
if(extra <= 0) if(extra <= 0)
{ {
curr = firstBorn; curr = firstBorn;
@ -152,7 +152,7 @@
} }
} }
} }
//assign new positions/heights //assign new positions/heights
float y = 0; float y = 0;
curr = firstBorn; curr = firstBorn;
@ -175,7 +175,7 @@
[self OG_resizeChildren]; [self OG_resizeChildren];
return DefWindowProc(hwnd, msg, wparam, lparam); return DefWindowProc(hwnd, msg, wparam, lparam);
break; break;
case WM_SIZING: case WM_SIZING:
[self OG_resizeChildren]; [self OG_resizeChildren];
return DefWindowProc(hwnd, msg, wparam, lparam); return DefWindowProc(hwnd, msg, wparam, lparam);

View file

@ -38,13 +38,13 @@ void og_destroy(HWND widget, OGWidget *object)
- init - init
{ {
self = [super init]; self = [super init];
widget = NULL; widget = NULL;
HINSTANCE hInst = (HINSTANCE)GetModuleHandle(NULL); HINSTANCE hInst = (HINSTANCE)GetModuleHandle(NULL);
widget = CreateWindowEx(WS_EX_LEFT, "OGWidgetClass", "OGWidget", WS_OVERLAPPEDWINDOW, widget = CreateWindowEx(WS_EX_LEFT, "OGWidgetClass", "OGWidget", WS_OVERLAPPEDWINDOW,
0, 0, 1, 1, NULL, NULL, hInst, NULL); 0, 0, 1, 1, NULL, NULL, hInst, NULL);
SetWindowLong(widget, GWL_USERDATA, (int)self); SetWindowLong(widget, GWL_USERDATA, (int)self);
@try { @try {
if (isa == [OGWidget class]) if (isa == [OGWidget class])
@throw [OFNotImplementedException @throw [OFNotImplementedException

View file

@ -44,7 +44,7 @@ static int CALLBACK Resize_EnumChildren(HWND child, LPARAM lparam)
//so make sure child.parent == use //so make sure child.parent == use
HWND parent = (HWND)lparam; HWND parent = (HWND)lparam;
if(GetParent(child) != parent) return 1; if(GetParent(child) != parent) return 1;
RECT rc; RECT rc;
GetClientRect(parent, &rc); GetClientRect(parent, &rc);
SetWindowPos(child, NULL, 0, 0, rc.right, rc.bottom, SetWindowPos(child, NULL, 0, 0, rc.right, rc.bottom,
@ -67,7 +67,7 @@ static int CALLBACK Resize_EnumChildren(HWND child, LPARAM lparam)
SetWindowLong(widget, GWL_EXSTYLE, WS_EX_OVERLAPPEDWINDOW); SetWindowLong(widget, GWL_EXSTYLE, WS_EX_OVERLAPPEDWINDOW);
//"event connections" are handled in MessageReceived //"event connections" are handled in MessageReceived
[self retain]; [self retain];
return self; return self;
} }
@ -77,7 +77,7 @@ static int CALLBACK Resize_EnumChildren(HWND child, LPARAM lparam)
int tlen = GetWindowTextLength(widget); int tlen = GetWindowTextLength(widget);
char *buff = (char *)malloc(tlen + 1); char *buff = (char *)malloc(tlen + 1);
GetWindowText(widget, buff, tlen+1); GetWindowText(widget, buff, tlen+1);
OFString *ret = [OFString stringWithUTF8String : buff]; OFString *ret = [OFString stringWithUTF8String : buff];
free(buff); free(buff);
return ret; return ret;
@ -138,7 +138,7 @@ static int CALLBACK Resize_EnumChildren(HWND child, LPARAM lparam)
- (int)MessageReceived : (HWND)hwnd : (UINT)msg : (WPARAM)wparam : (LPARAM)lparam - (int)MessageReceived : (HWND)hwnd : (UINT)msg : (WPARAM)wparam : (LPARAM)lparam
{ {
HWND ctrlHwnd; HWND ctrlHwnd;
switch(msg) switch(msg)
{ {
case WM_COMMAND: case WM_COMMAND:
@ -150,18 +150,18 @@ static int CALLBACK Resize_EnumChildren(HWND child, LPARAM lparam)
chd->funct(chd->object, wparam); chd->funct(chd->object, wparam);
return 0; return 0;
break; break;
case WM_CLOSE: case WM_CLOSE:
if([self OG_willClose] == YES) if([self OG_willClose] == YES)
og_destroy(hwnd, self); og_destroy(hwnd, self);
return 0; return 0;
break; break;
case WM_SIZE: case WM_SIZE:
//act like GTK; expand our child(ren) to fit //act like GTK; expand our child(ren) to fit
EnumChildWindows(widget, Resize_EnumChildren, (LPARAM)widget); EnumChildWindows(widget, Resize_EnumChildren, (LPARAM)widget);
break; break;
case WM_SIZING: case WM_SIZING:
//act like GTK; expand our child(ren) to fit //act like GTK; expand our child(ren) to fit
EnumChildWindows(widget, Resize_EnumChildren, (LPARAM)widget); EnumChildWindows(widget, Resize_EnumChildren, (LPARAM)widget);

View file

@ -38,13 +38,13 @@
- init - init
{ {
self = [super init]; self = [super init];
items = (OGComboBoxItem **)malloc(sizeof(OGComboBoxItem *) << 2); items = (OGComboBoxItem **)malloc(sizeof(OGComboBoxItem *) << 2);
items[0] = [OGComboBoxItem comboBoxItemWithLabel : @"Test Combo Item 0"]; items[0] = [OGComboBoxItem comboBoxItemWithLabel : @"Test Combo Item 0"];
items[1] = [OGComboBoxItem comboBoxItemWithLabel : @"Test Combo Item 1"]; items[1] = [OGComboBoxItem comboBoxItemWithLabel : @"Test Combo Item 1"];
items[2] = [OGComboBoxItem comboBoxItemWithLabel : @"Test Combo Item 2"]; items[2] = [OGComboBoxItem comboBoxItemWithLabel : @"Test Combo Item 2"];
items[3] = [OGComboBoxItem comboBoxItemWithLabel : @"Test Combo Item 3"]; items[3] = [OGComboBoxItem comboBoxItemWithLabel : @"Test Combo Item 3"];
[self retain]; [self retain];
return self; return self;
} }
@ -89,7 +89,7 @@ OG_APPLICATION_DELEGATE(Test)
expand: YES expand: YES
fill: YES fill: YES
padding: 0]; padding: 0];
OGComboBox *cb = [[OGComboBox alloc] initWithParent : hboxPre]; OGComboBox *cb = [[OGComboBox alloc] initWithParent : hboxPre];
cb.dataSource = [[TestSource alloc] init]; cb.dataSource = [[TestSource alloc] init];
cb.delegate = self; cb.delegate = self;