Fixed up AddColumn parameter and private fields names; made them consistent.
This commit is contained in:
parent
4dbf1994a6
commit
72c7c05f04
|
@ -57,7 +57,7 @@ struct textColumnCreateParams {
|
|||
|
||||
BOOL makeTextField;
|
||||
int textModelColumn;
|
||||
int textEditableColumn;
|
||||
int textEditableModelColumn;
|
||||
uiTableTextColumnOptionalParams textParams;
|
||||
|
||||
BOOL makeImage;
|
||||
|
@ -65,7 +65,7 @@ struct textColumnCreateParams {
|
|||
|
||||
BOOL makeCheckbox;
|
||||
int checkboxModelColumn;
|
||||
int checkboxEditableColumn;
|
||||
int checkboxEditableModelColumn;
|
||||
};
|
||||
|
||||
@interface uiprivTextImageCheckboxTableCellView : uiprivTableCellView {
|
||||
|
@ -74,7 +74,7 @@ struct textColumnCreateParams {
|
|||
|
||||
NSTextField *tf;
|
||||
int textModelColumn;
|
||||
int textEditableColumn;
|
||||
int textEditableModelColumn;
|
||||
uiTableTextColumnOptionalParams textParams;
|
||||
|
||||
NSImageView *iv;
|
||||
|
@ -82,7 +82,7 @@ struct textColumnCreateParams {
|
|||
|
||||
NSButton *cb;
|
||||
int checkboxModelColumn;
|
||||
int checkboxEditableColumn;
|
||||
int checkboxEditableModelColumn;
|
||||
}
|
||||
- (id)initWithFrame:(NSRect)r params:(struct textColumnCreateParams *)p;
|
||||
- (IBAction)uiprivOnTextFieldAction:(id)sender;
|
||||
|
@ -104,7 +104,7 @@ struct textColumnCreateParams {
|
|||
self->tf = nil;
|
||||
if (p->makeTextField) {
|
||||
self->textModelColumn = p->textModelColumn;
|
||||
self->textEditableColumn = p->textEditableColumn;
|
||||
self->textEditableModelColumn = p->textEditableModelColumn;
|
||||
self->textParams = p->textParams;
|
||||
|
||||
self->tf = uiprivNewLabel(@"");
|
||||
|
@ -189,7 +189,7 @@ struct textColumnCreateParams {
|
|||
self->cb = nil;
|
||||
if (p->makeCheckbox) {
|
||||
self->checkboxModelColumn = p->checkboxModelColumn;
|
||||
self->checkboxEditableColumn = p->checkboxEditableColumn;
|
||||
self->checkboxEditableModelColumn = p->checkboxEditableModelColumn;
|
||||
|
||||
self->cb = [[NSButton alloc] initWithFrame:NSZeroRect];
|
||||
[self->cb setTitle:@""];
|
||||
|
@ -272,7 +272,7 @@ struct textColumnCreateParams {
|
|||
uiFreeTableValue(value);
|
||||
[self->tf setStringValue:str];
|
||||
|
||||
[self->tf setEditable:isCellEditable(self->m, row, self->textEditableColumn)];
|
||||
[self->tf setEditable:isCellEditable(self->m, row, self->textEditableModelColumn)];
|
||||
|
||||
color = nil;
|
||||
if (self->textParams.ColorModelColumn != -1) {
|
||||
|
@ -307,7 +307,7 @@ struct textColumnCreateParams {
|
|||
[self->cb setState:NSOffState];
|
||||
uiFreeTableValue(value);
|
||||
|
||||
[self->cb setEnabled:isCellEditable(self->m, row, self->checkboxEditableColumn)];
|
||||
[self->cb setEnabled:isCellEditable(self->m, row, self->checkboxEditableModelColumn)];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -606,7 +606,7 @@ struct textColumnCreateParams {
|
|||
|
||||
@end
|
||||
|
||||
void uiTableAppendTextColumn(uiTable *t, const char *name, int textModelColumn, int textEditableModelColumn, uiTableTextColumnOptionalParams *params)
|
||||
void uiTableAppendTextColumn(uiTable *t, const char *name, int textModelColumn, int textEditableModelColumn, uiTableTextColumnOptionalParams *textParams)
|
||||
{
|
||||
struct textColumnCreateParams p;
|
||||
uiprivTableColumn *col;
|
||||
|
@ -618,9 +618,9 @@ void uiTableAppendTextColumn(uiTable *t, const char *name, int textModelColumn,
|
|||
|
||||
p.makeTextField = YES;
|
||||
p.textModelColumn = textModelColumn;
|
||||
p.textEditableColumn = textEditableModelColumn;
|
||||
if (params != NULL)
|
||||
p.textParams = *params;
|
||||
p.textEditableModelColumn = textEditableModelColumn;
|
||||
if (textParams != NULL)
|
||||
p.textParams = *textParams;
|
||||
else
|
||||
p.textParams = uiprivDefaultTextColumnOptionalParams;
|
||||
|
||||
|
@ -661,7 +661,7 @@ void uiTableAppendImageTextColumn(uiTable *t, const char *name, int imageModelCo
|
|||
|
||||
p.makeTextField = YES;
|
||||
p.textModelColumn = textModelColumn;
|
||||
p.textEditableColumn = textEditableModelColumn;
|
||||
p.textEditableModelColumn = textEditableModelColumn;
|
||||
if (textParams != NULL)
|
||||
p.textParams = *textParams;
|
||||
else
|
||||
|
@ -688,7 +688,7 @@ void uiTableAppendCheckboxColumn(uiTable *t, const char *name, int checkboxModel
|
|||
|
||||
p.makeCheckbox = YES;
|
||||
p.checkboxModelColumn = checkboxModelColumn;
|
||||
p.checkboxEditableColumn = checkboxEditableModelColumn;
|
||||
p.checkboxEditableModelColumn = checkboxEditableModelColumn;
|
||||
|
||||
str = [NSString stringWithUTF8String:name];
|
||||
col = [[uiprivTextImageCheckboxTableColumn alloc] initWithIdentifier:str params:&p];
|
||||
|
@ -708,7 +708,7 @@ void uiTableAppendCheckboxTextColumn(uiTable *t, const char *name, int checkboxM
|
|||
|
||||
p.makeTextField = YES;
|
||||
p.textModelColumn = textModelColumn;
|
||||
p.textEditableColumn = textEditableModelColumn;
|
||||
p.textEditableModelColumn = textEditableModelColumn;
|
||||
if (textParams != NULL)
|
||||
p.textParams = *textParams;
|
||||
else
|
||||
|
@ -716,7 +716,7 @@ void uiTableAppendCheckboxTextColumn(uiTable *t, const char *name, int checkboxM
|
|||
|
||||
p.makeCheckbox = YES;
|
||||
p.checkboxModelColumn = checkboxModelColumn;
|
||||
p.checkboxEditableColumn = checkboxEditableModelColumn;
|
||||
p.checkboxEditableModelColumn = checkboxEditableModelColumn;
|
||||
|
||||
str = [NSString stringWithUTF8String:name];
|
||||
col = [[uiprivTextImageCheckboxTableColumn alloc] initWithIdentifier:str params:&p];
|
||||
|
@ -735,13 +735,13 @@ void uiTableAppendProgressBarColumn(uiTable *t, const char *name, int progressMo
|
|||
[t->tv addTableColumn:col];
|
||||
}
|
||||
|
||||
void uiTableAppendButtonColumn(uiTable *t, const char *name, int buttonTextModelColumn, int buttonClickableModelColumn)
|
||||
void uiTableAppendButtonColumn(uiTable *t, const char *name, int buttonModelColumn, int buttonClickableModelColumn)
|
||||
{
|
||||
uiprivTableColumn *col;
|
||||
NSString *str;
|
||||
|
||||
str = [NSString stringWithUTF8String:name];
|
||||
col = [[uiprivButtonTableColumn alloc] initWithIdentifier:str table:t model:t->m modelColumn:buttonTextModelColumn editableColumn:buttonClickableModelColumn];
|
||||
col = [[uiprivButtonTableColumn alloc] initWithIdentifier:str table:t model:t->m modelColumn:buttonModelColumn editableColumn:buttonClickableModelColumn];
|
||||
[col setTitle:str];
|
||||
[t->tv addTableColumn:col];
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ _UI_EXTERN void uiTableAppendTextColumn(uiTable *t,
|
|||
const char *name,
|
||||
int textModelColumn,
|
||||
int textEditableModelColumn,
|
||||
uiTableTextColumnOptionalParams *params);
|
||||
uiTableTextColumnOptionalParams *textParams);
|
||||
_UI_EXTERN void uiTableAppendImageColumn(uiTable *t,
|
||||
const char *name,
|
||||
int imageModelColumn);
|
||||
|
@ -95,7 +95,7 @@ _UI_EXTERN void uiTableAppendProgressBarColumn(uiTable *t,
|
|||
int progressModelColumn);
|
||||
_UI_EXTERN void uiTableAppendButtonColumn(uiTable *t,
|
||||
const char *name,
|
||||
int buttonTextModelColumn,
|
||||
int buttonModelColumn,
|
||||
int buttonClickableModelColumn);
|
||||
// TODO getter?
|
||||
_UI_EXTERN void uiTableSetRowBackgroundColorModelColumn(uiTable *t, int modelColumn);
|
||||
|
|
14
unix/table.c
14
unix/table.c
|
@ -263,7 +263,7 @@ static GtkTreeViewColumn *addColumn(uiTable *t, const char *name)
|
|||
return c;
|
||||
}
|
||||
|
||||
static void addTextColumn(uiTable *t, GtkTreeViewColumn *c, int textModelColumn, int textEditableModelColumn, uiTableTextColumnOptionalParams *params)
|
||||
static void addTextColumn(uiTable *t, GtkTreeViewColumn *c, int textModelColumn, int textEditableModelColumn, uiTableTextColumnOptionalParams *textParams)
|
||||
{
|
||||
struct textColumnParams *p;
|
||||
GtkCellRenderer *r;
|
||||
|
@ -274,8 +274,8 @@ static void addTextColumn(uiTable *t, GtkTreeViewColumn *c, int textModelColumn,
|
|||
p->m = t->model;
|
||||
p->modelColumn = textModelColumn;
|
||||
p->editableColumn = textEditableModelColumn;
|
||||
if (params != NULL)
|
||||
p->params = *params;
|
||||
if (textParams != NULL)
|
||||
p->params = *textParams;
|
||||
else
|
||||
p->params = uiprivDefaultTextColumnOptionalParams;
|
||||
|
||||
|
@ -287,12 +287,12 @@ static void addTextColumn(uiTable *t, GtkTreeViewColumn *c, int textModelColumn,
|
|||
}
|
||||
|
||||
// TODO rename modelCOlumn and params everywhere
|
||||
void uiTableAppendTextColumn(uiTable *t, const char *name, int textModelColumn, int textEditableModelColumn, uiTableTextColumnOptionalParams *params)
|
||||
void uiTableAppendTextColumn(uiTable *t, const char *name, int textModelColumn, int textEditableModelColumn, uiTableTextColumnOptionalParams *textParams)
|
||||
{
|
||||
GtkTreeViewColumn *c;
|
||||
|
||||
c = addColumn(t, name);
|
||||
addTextColumn(t, c, textModelColumn, textEditableModelColumn, params);
|
||||
addTextColumn(t, c, textModelColumn, textEditableModelColumn, textParams);
|
||||
}
|
||||
|
||||
static void addImageColumn(uiTable *t, GtkTreeViewColumn *c, int imageModelColumn)
|
||||
|
@ -381,7 +381,7 @@ void uiTableAppendProgressBarColumn(uiTable *t, const char *name, int progressMo
|
|||
g_ptr_array_add(t->columnParams, p);
|
||||
}
|
||||
|
||||
void uiTableAppendButtonColumn(uiTable *t, const char *name, int buttonTextModelColumn, int buttonClickableModelColumn)
|
||||
void uiTableAppendButtonColumn(uiTable *t, const char *name, int buttonModelColumn, int buttonClickableModelColumn)
|
||||
{
|
||||
GtkTreeViewColumn *c;
|
||||
struct buttonColumnParams *p;
|
||||
|
@ -392,7 +392,7 @@ void uiTableAppendButtonColumn(uiTable *t, const char *name, int buttonTextModel
|
|||
p = uiprivNew(struct buttonColumnParams);
|
||||
p->t = t;
|
||||
p->m = t->model;
|
||||
p->modelColumn = buttonTextModelColumn;
|
||||
p->modelColumn = buttonModelColumn;
|
||||
p->clickableColumn = buttonClickableModelColumn;
|
||||
|
||||
r = uiprivNewCellRendererButton();
|
||||
|
|
|
@ -396,26 +396,26 @@ static uiprivTableColumnParams *appendColumn(uiTable *t, const char *name, int c
|
|||
|
||||
p = uiprivNew(uiprivTableColumnParams);
|
||||
p->textModelColumn = -1;
|
||||
p->textEditableColumn = -1;
|
||||
p->textEditableModelColumn = -1;
|
||||
p->textParams = uiprivDefaultTextColumnOptionalParams;
|
||||
p->imageModelColumn = -1;
|
||||
p->checkboxModelColumn = -1;
|
||||
p->checkboxEditableColumn = -1;
|
||||
p->checkboxEditableModelColumn = -1;
|
||||
p->progressBarModelColumn = -1;
|
||||
p->buttonModelColumn = -1;
|
||||
t->columns->push_back(p);
|
||||
return p;
|
||||
}
|
||||
|
||||
void uiTableAppendTextColumn(uiTable *t, const char *name, int textModelColumn, int textEditableModelColumn, uiTableTextColumnOptionalParams *params)
|
||||
void uiTableAppendTextColumn(uiTable *t, const char *name, int textModelColumn, int textEditableModelColumn, uiTableTextColumnOptionalParams *textParams)
|
||||
{
|
||||
uiprivTableColumnParams *p;
|
||||
|
||||
p = appendColumn(t, name, LVCFMT_LEFT);
|
||||
p->textModelColumn = textModelColumn;
|
||||
p->textEditableColumn = textEditableModelColumn;
|
||||
if (params != NULL)
|
||||
p->textParams = *params;
|
||||
p->textEditableModelColumn = textEditableModelColumn;
|
||||
if (textParams != NULL)
|
||||
p->textParams = *textParams;
|
||||
}
|
||||
|
||||
void uiTableAppendImageColumn(uiTable *t, const char *name, int imageModelColumn)
|
||||
|
@ -432,7 +432,7 @@ void uiTableAppendImageTextColumn(uiTable *t, const char *name, int imageModelCo
|
|||
|
||||
p = appendColumn(t, name, LVCFMT_LEFT);
|
||||
p->textModelColumn = textModelColumn;
|
||||
p->textEditableColumn = textEditableModelColumn;
|
||||
p->textEditableModelColumn = textEditableModelColumn;
|
||||
if (textParams != NULL)
|
||||
p->textParams = *textParams;
|
||||
p->imageModelColumn = imageModelColumn;
|
||||
|
@ -444,7 +444,7 @@ void uiTableAppendCheckboxColumn(uiTable *t, const char *name, int checkboxModel
|
|||
|
||||
p = appendColumn(t, name, LVCFMT_LEFT);
|
||||
p->checkboxModelColumn = checkboxModelColumn;
|
||||
p->checkboxEditableColumn = checkboxEditableModelColumn;
|
||||
p->checkboxEditableModelColumn = checkboxEditableModelColumn;
|
||||
}
|
||||
|
||||
void uiTableAppendCheckboxTextColumn(uiTable *t, const char *name, int checkboxModelColumn, int checkboxEditableModelColumn, int textModelColumn, int textEditableModelColumn, uiTableTextColumnOptionalParams *textParams)
|
||||
|
@ -453,11 +453,11 @@ void uiTableAppendCheckboxTextColumn(uiTable *t, const char *name, int checkboxM
|
|||
|
||||
p = appendColumn(t, name, LVCFMT_LEFT);
|
||||
p->textModelColumn = textModelColumn;
|
||||
p->textEditableColumn = textEditableModelColumn;
|
||||
p->textEditableModelColumn = textEditableModelColumn;
|
||||
if (textParams != NULL)
|
||||
p->textParams = *textParams;
|
||||
p->checkboxModelColumn = checkboxModelColumn;
|
||||
p->checkboxEditableColumn = checkboxEditableModelColumn;
|
||||
p->checkboxEditableModelColumn = checkboxEditableModelColumn;
|
||||
}
|
||||
|
||||
void uiTableAppendProgressBarColumn(uiTable *t, const char *name, int progressModelColumn)
|
||||
|
@ -468,13 +468,13 @@ void uiTableAppendProgressBarColumn(uiTable *t, const char *name, int progressMo
|
|||
p->progressBarModelColumn = progressModelColumn;
|
||||
}
|
||||
|
||||
void uiTableAppendButtonColumn(uiTable *t, const char *name, int buttonTextModelColumn, int buttonClickableModelColumn)
|
||||
void uiTableAppendButtonColumn(uiTable *t, const char *name, int buttonModelColumn, int buttonClickableModelColumn)
|
||||
{
|
||||
uiprivTableColumnParams *p;
|
||||
|
||||
// TODO see if we can get rid of this parameter
|
||||
p = appendColumn(t, name, LVCFMT_LEFT);
|
||||
p->buttonModelColumn = buttonTextModelColumn;
|
||||
p->buttonModelColumn = buttonModelColumn;
|
||||
p->buttonClickableModelColumn = buttonClickableModelColumn;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,13 +10,13 @@ struct uiTableModel {
|
|||
typedef struct uiprivTableColumnParams uiprivTableColumnParams;
|
||||
struct uiprivTableColumnParams {
|
||||
int textModelColumn;
|
||||
int textEditableColumn;
|
||||
int textEditableModelColumn;
|
||||
uiTableTextColumnOptionalParams textParams;
|
||||
|
||||
int imageModelColumn;
|
||||
|
||||
int checkboxModelColumn;
|
||||
int checkboxEditableColumn;
|
||||
int checkboxEditableModelColumn;
|
||||
|
||||
int progressBarModelColumn;
|
||||
|
||||
|
|
|
@ -197,7 +197,7 @@ static HRESULT drawCheckboxPart(HRESULT hr, struct drawState *s)
|
|||
value = uiprivTableModelCellValue(s->model, s->iItem, s->p->checkboxModelColumn);
|
||||
checked = uiTableValueInt(value);
|
||||
uiFreeTableValue(value);
|
||||
switch (s->p->checkboxEditableColumn) {
|
||||
switch (s->p->checkboxEditableModelColumn) {
|
||||
case uiTableModelColumnNeverEditable:
|
||||
enabled = 0;
|
||||
break;
|
||||
|
@ -205,7 +205,7 @@ static HRESULT drawCheckboxPart(HRESULT hr, struct drawState *s)
|
|||
enabled = 1;
|
||||
break;
|
||||
default:
|
||||
value = uiprivTableModelCellValue(s->model, s->iItem, s->p->checkboxEditableColumn);
|
||||
value = uiprivTableModelCellValue(s->model, s->iItem, s->p->checkboxEditableModelColumn);
|
||||
enabled = uiTableValueInt(value);
|
||||
uiFreeTableValue(value);
|
||||
}
|
||||
|
@ -422,7 +422,7 @@ static HRESULT drawButtonPart(HRESULT hr, struct drawState *s)
|
|||
enabled = 1;
|
||||
break;
|
||||
default:
|
||||
value = uiprivTableModelCellValue(s->model, s->iItem, s->p->checkboxEditableColumn);
|
||||
value = uiprivTableModelCellValue(s->model, s->iItem, s->p->checkboxEditableModelColumn);
|
||||
enabled = uiTableValueInt(value);
|
||||
uiFreeTableValue(value);
|
||||
}
|
||||
|
|
|
@ -215,11 +215,11 @@ HRESULT uiprivTableHandleNM_CLICK(uiTable *t, NMITEMACTIVATE *nm, LRESULT *lResu
|
|||
p = (*(t->columns))[ht.iSubItem];
|
||||
if (p->textModelColumn != -1) {
|
||||
modelColumn = p->textModelColumn;
|
||||
editableColumn = p->textEditableColumn;
|
||||
editableColumn = p->textEditableModelColumn;
|
||||
text = true;
|
||||
} else if (p->checkboxModelColumn != -1) {
|
||||
modelColumn = p->checkboxModelColumn;
|
||||
editableColumn = p->checkboxEditableColumn;
|
||||
editableColumn = p->checkboxEditableModelColumn;
|
||||
checkbox = true;
|
||||
} else if (p->buttonModelColumn != -1) {
|
||||
modelColumn = p->buttonModelColumn;
|
||||
|
|
Loading…
Reference in New Issue