mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +01:00
WINGs: Added 'const' attribute to functions in wbrowser, wcolorpanel, wfilepanel and wfontpanel
This makes both the API and local function const-correct on their input parameters.
This commit is contained in:
committed by
Carlos R. Mafra
parent
c89e8df33f
commit
a1119f8dd3
@@ -1248,7 +1248,7 @@ void WMSetBrowserAllowMultipleSelection(WMBrowser *bPtr, Bool flag);
|
|||||||
|
|
||||||
void WMSetBrowserAllowEmptySelection(WMBrowser *bPtr, Bool flag);
|
void WMSetBrowserAllowEmptySelection(WMBrowser *bPtr, Bool flag);
|
||||||
|
|
||||||
void WMSetBrowserPathSeparator(WMBrowser *bPtr, char *separator);
|
void WMSetBrowserPathSeparator(WMBrowser *bPtr, const char *separator);
|
||||||
|
|
||||||
void WMSetBrowserTitled(WMBrowser *bPtr, Bool flag);
|
void WMSetBrowserTitled(WMBrowser *bPtr, Bool flag);
|
||||||
|
|
||||||
@@ -1260,9 +1260,9 @@ void WMRemoveBrowserItem(WMBrowser *bPtr, int column, int row);
|
|||||||
|
|
||||||
void WMSetBrowserMaxVisibleColumns(WMBrowser *bPtr, int columns);
|
void WMSetBrowserMaxVisibleColumns(WMBrowser *bPtr, int columns);
|
||||||
|
|
||||||
void WMSetBrowserColumnTitle(WMBrowser *bPtr, int column, char *title);
|
void WMSetBrowserColumnTitle(WMBrowser *bPtr, int column, const char *title);
|
||||||
|
|
||||||
WMListItem* WMInsertBrowserItem(WMBrowser *bPtr, int column, int row, char *text, Bool isBranch);
|
WMListItem* WMInsertBrowserItem(WMBrowser *bPtr, int column, int row, const char *text, Bool isBranch);
|
||||||
|
|
||||||
void WMSortBrowserColumn(WMBrowser *bPtr, int column);
|
void WMSortBrowserColumn(WMBrowser *bPtr, int column);
|
||||||
|
|
||||||
@@ -1806,7 +1806,7 @@ char* WMGetFilePanelFileName(WMFilePanel *panel);
|
|||||||
void WMFreeFilePanel(WMFilePanel *panel);
|
void WMFreeFilePanel(WMFilePanel *panel);
|
||||||
|
|
||||||
int WMRunModalFilePanelForDirectory(WMFilePanel *panel, WMWindow *owner,
|
int WMRunModalFilePanelForDirectory(WMFilePanel *panel, WMWindow *owner,
|
||||||
char *path, char *name, char **fileTypes);
|
char *path, const char *name, char **fileTypes);
|
||||||
|
|
||||||
void WMSetFilePanelAccessoryView(WMFilePanel *panel, WMView *view);
|
void WMSetFilePanelAccessoryView(WMFilePanel *panel, WMView *view);
|
||||||
|
|
||||||
@@ -1826,7 +1826,7 @@ void WMFreeFontPanel(WMFontPanel *panel);
|
|||||||
|
|
||||||
void WMSetFontPanelAction(WMFontPanel *panel, WMAction2 *action, void *data);
|
void WMSetFontPanelAction(WMFontPanel *panel, WMAction2 *action, void *data);
|
||||||
|
|
||||||
void WMSetFontPanelFont(WMFontPanel *panel, char *fontName);
|
void WMSetFontPanelFont(WMFontPanel *panel, const char *fontName);
|
||||||
|
|
||||||
WMFont* WMGetFontPanelFont(WMFontPanel *panel);
|
WMFont* WMGetFontPanelFont(WMFontPanel *panel);
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ static void loadColumn(WMBrowser * bPtr, int column);
|
|||||||
|
|
||||||
static void removeColumn(WMBrowser * bPtr, int column);
|
static void removeColumn(WMBrowser * bPtr, int column);
|
||||||
|
|
||||||
static char *createTruncatedString(WMFont * font, char *text, int *textLen, int width);
|
static char *createTruncatedString(WMFont * font, const char *text, int *textLen, int width);
|
||||||
|
|
||||||
static void willResizeBrowser(W_ViewDelegate *, WMView *, unsigned int *, unsigned int *);
|
static void willResizeBrowser(W_ViewDelegate *, WMView *, unsigned int *, unsigned int *);
|
||||||
|
|
||||||
@@ -220,7 +220,7 @@ int WMGetBrowserNumberOfColumns(WMBrowser * bPtr)
|
|||||||
return bPtr->usedColumnCount;
|
return bPtr->usedColumnCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WMSetBrowserPathSeparator(WMBrowser * bPtr, char *separator)
|
void WMSetBrowserPathSeparator(WMBrowser * bPtr, const char *separator)
|
||||||
{
|
{
|
||||||
if (bPtr->pathSeparator)
|
if (bPtr->pathSeparator)
|
||||||
wfree(bPtr->pathSeparator);
|
wfree(bPtr->pathSeparator);
|
||||||
@@ -350,7 +350,7 @@ int WMGetBrowserSelectedRowInColumn(WMBrowser * bPtr, int column)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WMSetBrowserColumnTitle(WMBrowser * bPtr, int column, char *title)
|
void WMSetBrowserColumnTitle(WMBrowser * bPtr, int column, const char *title)
|
||||||
{
|
{
|
||||||
assert(column >= 0);
|
assert(column >= 0);
|
||||||
assert(column < bPtr->usedColumnCount);
|
assert(column < bPtr->usedColumnCount);
|
||||||
@@ -414,7 +414,7 @@ void WMSortBrowserColumnWithComparer(WMBrowser * bPtr, int column, WMCompareData
|
|||||||
WMSortListItemsWithComparer(bPtr->columns[column], func);
|
WMSortListItemsWithComparer(bPtr->columns[column], func);
|
||||||
}
|
}
|
||||||
|
|
||||||
WMListItem *WMInsertBrowserItem(WMBrowser * bPtr, int column, int row, char *text, Bool isBranch)
|
WMListItem *WMInsertBrowserItem(WMBrowser * bPtr, int column, int row, const char *text, Bool isBranch)
|
||||||
{
|
{
|
||||||
WMListItem *item;
|
WMListItem *item;
|
||||||
|
|
||||||
@@ -1116,7 +1116,7 @@ static void destroyBrowser(WMBrowser * bPtr)
|
|||||||
wfree(bPtr);
|
wfree(bPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *createTruncatedString(WMFont * font, char *text, int *textLen, int width)
|
static char *createTruncatedString(WMFont * font, const char *text, int *textLen, int width)
|
||||||
{
|
{
|
||||||
size_t slen;
|
size_t slen;
|
||||||
int dLen;
|
int dLen;
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ enum {
|
|||||||
#define M_PI 3.14159265358979323846
|
#define M_PI 3.14159265358979323846
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char *generateNewFilename(char *curName);
|
char *generateNewFilename(const char *curName);
|
||||||
void convertCPColor(CPColor * color);
|
void convertCPColor(CPColor * color);
|
||||||
RColor ulongToRColor(WMScreen * scr, unsigned long value);
|
RColor ulongToRColor(WMScreen * scr, unsigned long value);
|
||||||
unsigned char getShift(unsigned char value);
|
unsigned char getShift(unsigned char value);
|
||||||
@@ -360,7 +360,7 @@ void WMSetColorPanelAction(WMColorPanel * panel, WMAction2 * action, void *data)
|
|||||||
panel->clientData = data;
|
panel->clientData = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static WMColorPanel *makeColorPanel(WMScreen * scrPtr, char *name)
|
static WMColorPanel *makeColorPanel(WMScreen * scrPtr, const char *name)
|
||||||
{
|
{
|
||||||
WMColorPanel *panel;
|
WMColorPanel *panel;
|
||||||
RImage *image;
|
RImage *image;
|
||||||
@@ -3336,12 +3336,12 @@ static void hsbInit(W_ColorPanel * panel)
|
|||||||
|
|
||||||
/************************** Common utility functions ************************/
|
/************************** Common utility functions ************************/
|
||||||
|
|
||||||
char *generateNewFilename(char *curName)
|
char *generateNewFilename(const char *curName)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
char c;
|
char c;
|
||||||
int baseLen;
|
int baseLen;
|
||||||
char *ptr;
|
const char *ptr;
|
||||||
char *newName;
|
char *newName;
|
||||||
|
|
||||||
assert(curName);
|
assert(curName);
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ typedef struct W_FilePanel {
|
|||||||
#define PWIDTH 330
|
#define PWIDTH 330
|
||||||
#define PHEIGHT 360
|
#define PHEIGHT 360
|
||||||
|
|
||||||
static void listDirectoryOnColumn(WMFilePanel * panel, int column, char *path);
|
static void listDirectoryOnColumn(WMFilePanel * panel, int column, const char *path);
|
||||||
static void browserClick();
|
static void browserClick();
|
||||||
static void browserDClick();
|
static void browserDClick();
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ static WMBrowserDelegate browserDelegate = {
|
|||||||
NULL /* willScroll */
|
NULL /* willScroll */
|
||||||
};
|
};
|
||||||
|
|
||||||
static int closestListItem(WMList * list, char *text, Bool exact)
|
static int closestListItem(WMList * list, const char *text, Bool exact)
|
||||||
{
|
{
|
||||||
WMListItem *item;
|
WMListItem *item;
|
||||||
WMArray *items = WMGetListItems(list);
|
WMArray *items = WMGetListItems(list);
|
||||||
@@ -166,7 +166,7 @@ static void textEditedObserver(void *observerData, WMNotification * notification
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static WMFilePanel *makeFilePanel(WMScreen * scrPtr, char *name, char *title)
|
static WMFilePanel *makeFilePanel(WMScreen * scrPtr, const char *name, const char *title)
|
||||||
{
|
{
|
||||||
WMFilePanel *fPtr;
|
WMFilePanel *fPtr;
|
||||||
WMFont *largeFont;
|
WMFont *largeFont;
|
||||||
@@ -348,7 +348,7 @@ void WMFreeFilePanel(WMFilePanel * panel)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
WMRunModalFilePanelForDirectory(WMFilePanel * panel, WMWindow * owner, char *path, char *name, char **fileTypes)
|
WMRunModalFilePanelForDirectory(WMFilePanel * panel, WMWindow * owner, char *path, const char *name, char **fileTypes)
|
||||||
{
|
{
|
||||||
WMScreen *scr = WMWidgetScreen(panel->win);
|
WMScreen *scr = WMWidgetScreen(panel->win);
|
||||||
|
|
||||||
@@ -454,7 +454,7 @@ WMView *WMGetFilePanelAccessoryView(WMFilePanel * panel)
|
|||||||
return panel->accessoryView;
|
return panel->accessoryView;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *get_name_from_path(char *path)
|
static char *get_name_from_path(const char *path)
|
||||||
{
|
{
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
@@ -475,7 +475,7 @@ static char *get_name_from_path(char *path)
|
|||||||
return wstrdup(&(path[size]));
|
return wstrdup(&(path[size]));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int filterFileName(WMFilePanel * panel, char *file, Bool isDirectory)
|
static int filterFileName(WMFilePanel * panel, const char *file, Bool isDirectory)
|
||||||
{
|
{
|
||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
@@ -492,7 +492,7 @@ static int comparer(const void *a, const void *b)
|
|||||||
|
|
||||||
#undef CAST
|
#undef CAST
|
||||||
|
|
||||||
static void listDirectoryOnColumn(WMFilePanel * panel, int column, char *path)
|
static void listDirectoryOnColumn(WMFilePanel * panel, int column, const char *path)
|
||||||
{
|
{
|
||||||
WMBrowser *bPtr = panel->browser;
|
WMBrowser *bPtr = panel->browser;
|
||||||
struct dirent *dentry;
|
struct dirent *dentry;
|
||||||
@@ -584,7 +584,7 @@ static void browserClick(WMBrowser * bPtr, WMFilePanel * panel)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void showError(WMScreen * scr, WMWindow * owner, char *s, char *file)
|
static void showError(WMScreen * scr, WMWindow * owner, const char *s, const char *file)
|
||||||
{
|
{
|
||||||
char *errStr;
|
char *errStr;
|
||||||
|
|
||||||
|
|||||||
@@ -71,9 +71,9 @@ static int scalableFontSizes[] = {
|
|||||||
64
|
64
|
||||||
};
|
};
|
||||||
|
|
||||||
static void setFontPanelFontName(FontPanel * panel, char *family, char *style, double size);
|
static void setFontPanelFontName(FontPanel * panel, const char *family, const char *style, double size);
|
||||||
|
|
||||||
static int isXLFD(char *font, int *length_ret);
|
static int isXLFD(const char *font, int *length_ret);
|
||||||
|
|
||||||
static void arrangeLowerFrame(FontPanel * panel);
|
static void arrangeLowerFrame(FontPanel * panel);
|
||||||
|
|
||||||
@@ -313,7 +313,7 @@ WMFont *WMGetFontPanelFont(WMFontPanel * panel)
|
|||||||
return WMGetTextFieldFont(panel->sampleT);
|
return WMGetTextFieldFont(panel->sampleT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WMSetFontPanelFont(WMFontPanel * panel, char *fontName)
|
void WMSetFontPanelFont(WMFontPanel * panel, const char *fontName)
|
||||||
{
|
{
|
||||||
int fname_len;
|
int fname_len;
|
||||||
FcPattern *pattern;
|
FcPattern *pattern;
|
||||||
@@ -322,7 +322,7 @@ void WMSetFontPanelFont(WMFontPanel * panel, char *fontName)
|
|||||||
|
|
||||||
if (!isXLFD(fontName, &fname_len)) {
|
if (!isXLFD(fontName, &fname_len)) {
|
||||||
/* maybe its proper fontconfig and we can parse it */
|
/* maybe its proper fontconfig and we can parse it */
|
||||||
pattern = FcNameParse((FcChar8 *) fontName);
|
pattern = FcNameParse((const FcChar8 *) fontName);
|
||||||
} else {
|
} else {
|
||||||
/* maybe its proper xlfd and we can convert it to an FcPattern */
|
/* maybe its proper xlfd and we can convert it to an FcPattern */
|
||||||
pattern = XftXlfdParse(fontName, False, False);
|
pattern = XftXlfdParse(fontName, False, False);
|
||||||
@@ -386,7 +386,7 @@ static void arrangeLowerFrame(FontPanel * panel)
|
|||||||
|
|
||||||
#define NUM_FIELDS 14
|
#define NUM_FIELDS 14
|
||||||
|
|
||||||
static int isXLFD(char *font, int *length_ret)
|
static int isXLFD(const char *font, int *length_ret)
|
||||||
{
|
{
|
||||||
int c = 0;
|
int c = 0;
|
||||||
|
|
||||||
@@ -444,7 +444,7 @@ static void addSizeToTypeface(Typeface * face, int size)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addTypefaceToXftFamily(Family * fam, char *style)
|
static void addTypefaceToXftFamily(Family * fam, const char *style)
|
||||||
{
|
{
|
||||||
Typeface *face;
|
Typeface *face;
|
||||||
WMArrayIterator i;
|
WMArrayIterator i;
|
||||||
@@ -474,7 +474,7 @@ static void addTypefaceToXftFamily(Family * fam, char *style)
|
|||||||
* registries (same family but different registries)
|
* registries (same family but different registries)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static void addFontToXftFamily(WMHashTable * families, char *name, char *style)
|
static void addFontToXftFamily(WMHashTable * families, const char *name, const char *style)
|
||||||
{
|
{
|
||||||
WMArrayIterator i;
|
WMArrayIterator i;
|
||||||
WMArray *array;
|
WMArray *array;
|
||||||
@@ -723,7 +723,7 @@ static void sizeClick(WMWidget * w, void *data)
|
|||||||
preview(panel);
|
preview(panel);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setFontPanelFontName(FontPanel * panel, char *family, char *style, double size)
|
static void setFontPanelFontName(FontPanel * panel, const char *family, const char *style, double size)
|
||||||
{
|
{
|
||||||
int famrow;
|
int famrow;
|
||||||
int stlrow;
|
int stlrow;
|
||||||
|
|||||||
Reference in New Issue
Block a user