Index: trunk/src/action_helper.c =================================================================== --- trunk/src/action_helper.c (revision 3044) +++ trunk/src/action_helper.c (revision 3045) @@ -526,7 +526,7 @@ PinTypePtr via; if (!PCB->ViaOn) { - Message(_("You must turn via visibility on before\n" "you can place vias\n")); + Message(PCB_MSG_DEFAULT, _("You must turn via visibility on before\n" "you can place vias\n")); break; } if ((via = CreateNewVia(PCB->Data, Note.X, Note.Y, @@ -905,13 +905,13 @@ &Crosshair.AttachedObject.Ptr1, &Crosshair.AttachedObject.Ptr2, &Crosshair.AttachedObject.Ptr3); if (Crosshair.AttachedObject.Type == PCB_TYPE_NONE) { - Message("The first point of a polygon hole must be on a polygon.\n"); + Message(PCB_MSG_DEFAULT, "The first point of a polygon hole must be on a polygon.\n"); break; /* don't start doing anything if clicket out of polys */ } if (TEST_FLAG(PCB_FLAG_LOCK, (PolygonTypePtr) Crosshair.AttachedObject.Ptr2)) { - Message(_("Sorry, the object is locked\n")); + Message(PCB_MSG_DEFAULT, _("Sorry, the object is locked\n")); Crosshair.AttachedObject.Type = PCB_TYPE_NONE; break; } @@ -1034,7 +1034,7 @@ case PCB_MODE_REMOVE: if ((type = SearchScreen(Note.X, Note.Y, REMOVE_TYPES, &ptr1, &ptr2, &ptr3)) != PCB_TYPE_NONE) { if (TEST_FLAG(PCB_FLAG_LOCK, (LineTypePtr) ptr2)) { - Message(_("Sorry, the object is locked\n")); + Message(PCB_MSG_DEFAULT, _("Sorry, the object is locked\n")); break; } if (type == PCB_TYPE_ELEMENT) { @@ -1081,7 +1081,7 @@ if (Crosshair.AttachedObject.Type != PCB_TYPE_NONE) { if (conf_core.editor.mode == PCB_MODE_MOVE && TEST_FLAG(PCB_FLAG_LOCK, (PinTypePtr) Crosshair.AttachedObject.Ptr2)) { - Message(_("Sorry, the object is locked\n")); + Message(PCB_MSG_DEFAULT, _("Sorry, the object is locked\n")); Crosshair.AttachedObject.Type = PCB_TYPE_NONE; } else @@ -1127,7 +1127,7 @@ if (Crosshair.AttachedObject.Type != PCB_TYPE_NONE) { if (TEST_FLAG(PCB_FLAG_LOCK, (PolygonTypePtr) Crosshair.AttachedObject.Ptr2)) { - Message(_("Sorry, the object is locked\n")); + Message(PCB_MSG_DEFAULT, _("Sorry, the object is locked\n")); Crosshair.AttachedObject.Type = PCB_TYPE_NONE; break; } @@ -1204,7 +1204,7 @@ case PCB_TYPE_ARC: return get_style_size(F_SelectedArcs, out, 0, size_id); } - Message(_("Sorry, can't fetch the style of that object tpye (%x)\n"), type); + Message(PCB_MSG_DEFAULT, _("Sorry, can't fetch the style of that object tpye (%x)\n"), type); return -1; case F_SelectedPads: if (size_id != 2) /* don't mess with pad size */ @@ -1230,7 +1230,7 @@ return 0; case F_SelectedTexts: case F_SelectedNames: - Message(_("Sorry, can't change style of every selected object\n")); + Message(PCB_MSG_DEFAULT, _("Sorry, can't change style of every selected object\n")); return -1; } return 0; Index: trunk/src/buffer.c =================================================================== --- trunk/src/buffer.c (revision 3044) +++ trunk/src/buffer.c (revision 3045) @@ -118,7 +118,7 @@ } /* --------------------------------------------------------------------------- - * copies a line to buffer + * copies a line to buffer */ static void *AddLineToBuffer(LayerTypePtr Layer, LineTypePtr Line) { @@ -134,7 +134,7 @@ } /* --------------------------------------------------------------------------- - * copies an arc to buffer + * copies an arc to buffer */ static void *AddArcToBuffer(LayerTypePtr Layer, ArcTypePtr Arc) { @@ -248,7 +248,7 @@ } /* --------------------------------------------------------------------------- - * moves a line to buffer + * moves a line to buffer */ static void *MoveLineToBuffer(LayerType * layer, LineType * line) { @@ -270,7 +270,7 @@ } /* --------------------------------------------------------------------------- - * moves an arc to buffer + * moves an arc to buffer */ static void *MoveArcToBuffer(LayerType * layer, ArcType * arc) { @@ -497,11 +497,11 @@ return 1; if (elementlist_length(&PASTEBUFFER->Data->Element) == 0) { - Message("Footprint %s contains no elements", name); + Message(PCB_MSG_DEFAULT, "Footprint %s contains no elements", name); return 1; } if (elementlist_length(&PASTEBUFFER->Data->Element) > 1) { - Message("Footprint %s contains multiple elements", name); + Message(PCB_MSG_DEFAULT, "Footprint %s contains multiple elements", name); return 1; } @@ -533,7 +533,7 @@ LayerTypePtr clayer, slayer; if (elementlist_length(&Buffer->Data->Element) != 1) { - Message(_("Error! Buffer doesn't contain a single element\n")); + Message(PCB_MSG_DEFAULT, _("Error! Buffer doesn't contain a single element\n")); return (false); } /* @@ -682,7 +682,7 @@ { \ warned = true; \ Message \ - (_("Warning: All of the pads are on the opposite\n" \ + (PCB_MSG_WARNING, _("Warning: All of the pads are on the opposite\n" \ "side from the component - that's probably not what\n" \ "you wanted\n")); \ } \ @@ -750,11 +750,11 @@ END_LOOP; if (!hasParts) { DestroyObject(PCB->Data, PCB_TYPE_ELEMENT, Element, Element, Element); - Message(_("There was nothing to convert!\n" "Elements must have some silk, pads or pins.\n")); + Message(PCB_MSG_DEFAULT, _("There was nothing to convert!\n" "Elements must have some silk, pads or pins.\n")); return (false); } if (crooked) - Message(_("There were polygons that can't be made into pins!\n" "So they were not included in the element\n")); + Message(PCB_MSG_DEFAULT, _("There were polygons that can't be made into pins!\n" "So they were not included in the element\n")); Element->MarkX = Buffer->X; Element->MarkY = Buffer->Y; if (SWAP_IDENT) @@ -991,7 +991,7 @@ "angle is given in degrees. If no angle is given, the user is prompted\n" "for one.\n"; /* %start-doc actions FreeRotateBuffer - + Rotates the contents of the pastebuffer by an arbitrary angle. If no angle is given, the user is prompted for one. @@ -1047,13 +1047,13 @@ int i; if (elementlist_length(&Buffer->Data->Element)) { - Message(_("You can't mirror a buffer that has elements!\n")); + Message(PCB_MSG_DEFAULT, _("You can't mirror a buffer that has elements!\n")); return; } for (i = 0; i < max_copper_layer + 2; i++) { LayerTypePtr layer = Buffer->Data->Layer + i; if (textlist_length(&layer->Text)) { - Message(_("You can't mirror a buffer that has text!\n")); + Message(PCB_MSG_DEFAULT, _("You can't mirror a buffer that has text!\n")); return; } } @@ -1350,7 +1350,7 @@ case F_Save: if (elementlist_length(&PASTEBUFFER->Data->Element) == 0) { - Message(_("Buffer has no elements!\n")); + Message(PCB_MSG_DEFAULT, _("Buffer has no elements!\n")); break; } free_name = 0; Index: trunk/src/change.c =================================================================== --- trunk/src/change.c (revision 3044) +++ trunk/src/change.c (revision 3045) @@ -1159,7 +1159,7 @@ return (NULL); if (NAME_INDEX() == NAMEONPCB_INDEX) { if (conf_core.editor.unique_names && UniqueElementName(PCB->Data, NewName) != NewName) { - Message(_("Error: The name \"%s\" is not unique!\n"), NewName); + Message(PCB_MSG_DEFAULT, _("Error: The name \"%s\" is not unique!\n"), NewName); return ((char *) -1); } } Index: trunk/src/change_act.c =================================================================== --- trunk/src/change_act.c (revision 3044) +++ trunk/src/change_act.c (revision 3045) @@ -189,7 +189,7 @@ set_selected = value ? ClrSelectedJoin : SetSelectedJoin; } else { - Message(_("%s(): Flag \"%s\" is not valid\n"), cmd_name, flag_name); + Message(PCB_MSG_DEFAULT, _("%s(): Flag \"%s\" is not valid\n"), cmd_name, flag_name); return; } @@ -201,7 +201,7 @@ if ((type = SearchScreen(Crosshair.X, Crosshair.Y, CHANGESIZE_TYPES, &ptr1, &ptr2, &ptr3)) != PCB_TYPE_NONE) if (TEST_FLAG(PCB_FLAG_LOCK, (PinTypePtr) ptr2)) - Message(_("Sorry, the object is locked\n")); + Message(PCB_MSG_DEFAULT, _("Sorry, the object is locked\n")); if (set_object(type, ptr1, ptr2, ptr3)) SetChangedFlag(true); break; @@ -413,7 +413,7 @@ { if (type != PCB_TYPE_NONE) if (TEST_FLAG(PCB_FLAG_LOCK, (PinTypePtr) ptr2)) - Message(_("Sorry, the object is locked\n")); + Message(PCB_MSG_DEFAULT, _("Sorry, the object is locked\n")); if (tostyle) { if (ChangeObject1stSize(type, ptr1, ptr2, ptr3, value, absolute)) SetChangedFlag(true); Index: trunk/src/compat_fs.c =================================================================== --- trunk/src/compat_fs.c (revision 3044) +++ trunk/src/compat_fs.c (revision 3045) @@ -101,7 +101,7 @@ pid = fork(); if (pid < 0) { /* error */ - Message(_("Cannot fork!")); + Message(PCB_MSG_DEFAULT, _("Cannot fork!")); return 1; } else if (pid == 0) { Index: trunk/src/conf.c =================================================================== --- trunk/src/conf.c (revision 3044) +++ trunk/src/conf.c (revision 3045) @@ -95,7 +95,7 @@ resolve_path(fn, &efn, 0); f = fopen(efn, "r"); if (f != NULL) { /* warn only if the file is there - missing file is normal */ - Message("error: failed to load lht config: %s\n", efn); + Message(PCB_MSG_DEFAULT, "error: failed to load lht config: %s\n", efn); fclose(f); } free(efn); @@ -1001,7 +1001,7 @@ } if (idx >= nat->array_size) { - Message("Error: can't conf_set() %s[%d]: %d is beyond the end of the array (%d)\n", path, idx, idx, nat->array_size); + Message(PCB_MSG_DEFAULT, "Error: can't conf_set() %s[%d]: %d is beyond the end of the array (%d)\n", path, idx, idx, nat->array_size); free(path); return -1; } @@ -1024,7 +1024,7 @@ nn = lht_tree_path_(conf_root[target], cwd, last, 1, 0, NULL); if (nn == NULL) { if (conf_root_lock[target]) { - Message("WARNING: can't set config item %s because target in-memory lihata does not have the node and is tree-locked\n", path_); + Message(PCB_MSG_DEFAULT, "WARNING: can't set config item %s because target in-memory lihata does not have the node and is tree-locked\n", path_); free(path); return -1; } @@ -1397,7 +1397,7 @@ case CFR_PROJECT: fn = get_project_conf_name(project_fn, pcb_fn, &try); if (fn == NULL) { - Message("Error: can not save config to project file: %s does not exist - please create an empty file there first\n", try); + Message(PCB_MSG_DEFAULT, "Error: can not save config to project file: %s does not exist - please create an empty file there first\n", try); return -1; } break; @@ -1418,11 +1418,11 @@ if (end != NULL) { *end = '\0'; if (pcb_mkdir(path, 0755) == 0) { - Message("Created directory %s for saving %s\n", path, fn); + Message(PCB_MSG_DEFAULT, "Created directory %s for saving %s\n", path, fn); f = fopen(efn, "w"); } else - Message("Error: failed to creat directory %s for saving %s\n", path, efn); + Message(PCB_MSG_DEFAULT, "Error: failed to creat directory %s for saving %s\n", path, efn); } free(path); } @@ -1435,7 +1435,7 @@ fclose(f); } else - Message("Error: can't save config to %s - can't open the file for write\n", fn); + Message(PCB_MSG_DEFAULT, "Error: can't save config to %s - can't open the file for write\n", fn); } free(efn); Index: trunk/src/conf_act.c =================================================================== --- trunk/src/conf_act.c (revision 3044) +++ trunk/src/conf_act.c (revision 3045) @@ -53,13 +53,13 @@ int res; if (argc < 3) { - Message("conf(set) needs at least two arguments"); + Message(PCB_MSG_DEFAULT, "conf(set) needs at least two arguments"); return 1; } if (argc > 3) { role = conf_role_parse(argv[3]); if (role == CFR_invalid) { - Message("Invalid role: '%s'", argv[3]); + Message(PCB_MSG_DEFAULT, "Invalid role: '%s'", argv[3]); return 1; } } @@ -66,7 +66,7 @@ if (argc > 4) { pol = conf_policy_parse(argv[4]); if (pol == POL_invalid) { - Message("Invalid policy: '%s'", argv[4]); + Message(PCB_MSG_DEFAULT, "Invalid policy: '%s'", argv[4]); return 1; } } @@ -77,7 +77,7 @@ if (role == CFR_invalid) { conf_native_t *n = conf_get_field(argv[1]); if (n == NULL) { - Message("Invalid conf field '%s': no such path\n", argv[1]); + Message(PCB_MSG_DEFAULT, "Invalid conf field '%s': no such path\n", argv[1]); return 1; } res = conf_set_native(n, 0, val); @@ -85,7 +85,7 @@ else res = conf_set(role, path, -1, val, pol); if (res != 0) { - Message("conf(set) failed.\n"); + Message(PCB_MSG_DEFAULT, "conf(set) failed.\n"); return 1; } } @@ -97,21 +97,21 @@ int res; if (n == NULL) { - Message("Invalid conf field '%s': no such path\n", argv[1]); + Message(PCB_MSG_DEFAULT, "Invalid conf field '%s': no such path\n", argv[1]); return 1; } if (n->type != CFN_BOOLEAN) { - Message("Can not toggle '%s': not a boolean\n", argv[1]); + Message(PCB_MSG_DEFAULT, "Can not toggle '%s': not a boolean\n", argv[1]); return 1; } if (n->used != 1) { - Message("Can not toggle '%s': array size should be 1, not %d\n", argv[1], n->used); + Message(PCB_MSG_DEFAULT, "Can not toggle '%s': array size should be 1, not %d\n", argv[1], n->used); return 1; } if (argc > 2) { role = conf_role_parse(argv[2]); if (role == CFR_invalid) { - Message("Invalid role: '%s'", argv[2]); + Message(PCB_MSG_DEFAULT, "Invalid role: '%s'", argv[2]); return 1; } } @@ -125,7 +125,7 @@ res = conf_set(role, argv[1], -1, new_value, POL_OVERWRITE); if (res != 0) { - Message("Can not toggle '%s': failed to set new value\n", argv[1]); + Message(PCB_MSG_DEFAULT, "Can not toggle '%s': failed to set new value\n", argv[1]); return 1; } conf_update(argv[1]); @@ -135,7 +135,7 @@ conf_role_t role; role = conf_role_parse(argv[1]); if (role == CFR_invalid) { - Message("Invalid role: '%s'", argv[1]); + Message(PCB_MSG_DEFAULT, "Invalid role: '%s'", argv[1]); return 1; } conf_reset(role, ""); @@ -143,7 +143,7 @@ } else { - Message("Invalid conf command '%s'\n", argv[0]); + Message(PCB_MSG_DEFAULT, "Invalid conf command '%s'\n", argv[0]); return 1; } return 0; @@ -191,7 +191,7 @@ if (strcmp(m->name, argv[0]) == 0) return conf_core.editor.mode == m->mode; } - Message("Unknown mode in ChkMode(): %s\n", argv[1]); + Message(PCB_MSG_DEFAULT, "Unknown mode in ChkMode(): %s\n", argv[1]); abort(); return -1; } Index: trunk/src/create.c =================================================================== --- trunk/src/create.c (revision 3044) +++ trunk/src/create.c (revision 3045) @@ -220,7 +220,7 @@ VIA_LOOP(Data); { if (Distance(X, Y, via->X, via->Y) <= via->DrillingHole / 2 + DrillingHole / 2) { - Message(_("%m+Dropping via at %$mD because it's hole would overlap with the via " + Message(PCB_MSG_DEFAULT, _("%m+Dropping via at %$mD because it's hole would overlap with the via " "at %$mD\n"), conf_core.editor.grid_unit->allow, X, Y, via->X, via->Y); return (NULL); /* don't allow via stacking */ } @@ -240,7 +240,7 @@ Via->Mask = Mask; Via->DrillingHole = stub_vendorDrillMap(DrillingHole); if (Via->DrillingHole != DrillingHole) { - Message(_("%m+Mapped via drill hole to %$mS from %$mS per vendor table\n"), + Message(PCB_MSG_DEFAULT, _("%m+Mapped via drill hole to %$mS from %$mS per vendor table\n"), conf_core.editor.grid_unit->allow, Via->DrillingHole, DrillingHole); } @@ -256,7 +256,7 @@ */ if (!TEST_FLAG(PCB_FLAG_HOLE, Via) && (Via->Thickness < Via->DrillingHole + MIN_PINORVIACOPPER)) { Via->Thickness = Via->DrillingHole + MIN_PINORVIACOPPER; - Message(_("%m+Increased via thickness to %$mS to allow enough copper" + Message(PCB_MSG_DEFAULT, _("%m+Increased via thickness to %$mS to allow enough copper" " at %$mD.\n"), conf_core.editor.grid_unit->allow, Via->Thickness, Via->X, Via->Y); } @@ -738,18 +738,18 @@ /* Unless we should not map drills on this element, map them! */ if (stub_vendorIsElementMappable(Element)) { if (pin->DrillingHole < MIN_PINORVIASIZE) { - Message(_("%m+Did not map pin #%s (%s) drill hole because %$mS is below the minimum allowed size\n"), + Message(PCB_MSG_DEFAULT, _("%m+Did not map pin #%s (%s) drill hole because %$mS is below the minimum allowed size\n"), conf_core.editor.grid_unit->allow, UNKNOWN(Number), UNKNOWN(Name), pin->DrillingHole); pin->DrillingHole = DrillingHole; } else if (pin->DrillingHole > MAX_PINORVIASIZE) { - Message(_("%m+Did not map pin #%s (%s) drill hole because %$mS is above the maximum allowed size\n"), + Message(PCB_MSG_DEFAULT, _("%m+Did not map pin #%s (%s) drill hole because %$mS is above the maximum allowed size\n"), conf_core.editor.grid_unit->allow, UNKNOWN(Number), UNKNOWN(Name), pin->DrillingHole); pin->DrillingHole = DrillingHole; } else if (!TEST_FLAG(PCB_FLAG_HOLE, pin) && (pin->DrillingHole > pin->Thickness - MIN_PINORVIACOPPER)) { - Message(_("%m+Did not map pin #%s (%s) drill hole because %$mS does not leave enough copper\n"), + Message(PCB_MSG_DEFAULT, _("%m+Did not map pin #%s (%s) drill hole because %$mS does not leave enough copper\n"), conf_core.editor.grid_unit->allow, UNKNOWN(Number), UNKNOWN(Name), pin->DrillingHole); pin->DrillingHole = DrillingHole; } @@ -759,7 +759,7 @@ } if (pin->DrillingHole != DrillingHole) { - Message(_("%m+Mapped pin drill hole to %$mS from %$mS per vendor table\n"), + Message(PCB_MSG_DEFAULT, _("%m+Mapped pin drill hole to %$mS from %$mS per vendor table\n"), conf_core.editor.grid_unit->allow, pin->DrillingHole, DrillingHole); } @@ -861,7 +861,7 @@ const char *s; gds_t buff; s = conf_concat_strlist(&conf_core.rc.default_font_file, &buff, NULL, ':'); - Message(_("Can't find font-symbol-file '%s'\n"), s); + Message(PCB_MSG_DEFAULT, _("Can't find font-symbol-file '%s'\n"), s); gds_uninit(&buff); } } Index: trunk/src/crosshair.c =================================================================== --- trunk/src/crosshair.c (revision 3044) +++ trunk/src/crosshair.c (revision 3045) @@ -680,7 +680,7 @@ { static bool warned_old_api = false; if (!warned_old_api) { - Message(_("WARNING: A plugin is using the deprecated API HideCrosshair().\n" + Message(PCB_MSG_DEFAULT, _("WARNING: A plugin is using the deprecated API HideCrosshair().\n" " This API may be removed in a future release of PCB.\n")); warned_old_api = true; } @@ -693,7 +693,7 @@ { static bool warned_old_api = false; if (!warned_old_api) { - Message(_("WARNING: A plugin is using the deprecated API RestoreCrosshair().\n" + Message(PCB_MSG_DEFAULT, _("WARNING: A plugin is using the deprecated API RestoreCrosshair().\n" " This API may be removed in a future release of PCB.\n")); warned_old_api = true; } Index: trunk/src/draw.c =================================================================== --- trunk/src/draw.c (revision 3044) +++ trunk/src/draw.c (revision 3045) @@ -1617,7 +1617,7 @@ EraseArc((ArcTypePtr) ptr); break; default: - Message("hace: Internal ERROR, trying to erase an unknown type\n"); + Message(PCB_MSG_DEFAULT, "hace: Internal ERROR, trying to erase an unknown type\n"); } } Index: trunk/src/error.c =================================================================== --- trunk/src/error.c (revision 3044) +++ trunk/src/error.c (revision 3045) @@ -63,10 +63,12 @@ /* --------------------------------------------------------------------------- * output of message in a dialog window or log window */ -void Message(const char *Format, ...) +void Message(enum pcb_message_level level, const char *Format, ...) { va_list args; + // TODO(hzeller): do something useful with the level, e.g. color coding. + if (gui != NULL) { va_start(args, Format); gui->logv(Format, args); @@ -97,7 +99,7 @@ char *utf8 = NULL; utf8_dup_string(&utf8, Filename); - Message(_("Can't open file\n" " '%s'\nfopen() returned: '%s'\n"), utf8, strerror(errno)); + Message(PCB_MSG_DEFAULT, _("Can't open file\n" " '%s'\nfopen() returned: '%s'\n"), utf8, strerror(errno)); free(utf8); } @@ -109,7 +111,7 @@ char *utf8 = NULL; utf8_dup_string(&utf8, Filename); - Message(_("Can't execute command\n" " '%s'\npopen() returned: '%s'\n"), utf8, strerror(errno)); + Message(PCB_MSG_DEFAULT, _("Can't execute command\n" " '%s'\npopen() returned: '%s'\n"), utf8, strerror(errno)); free(utf8); } @@ -121,7 +123,7 @@ char *utf8 = NULL; utf8_dup_string(&utf8, DirName); - Message(_("Can't scan directory\n" " '%s'\nopendir() returned: '%s'\n"), utf8, strerror(errno)); + Message(PCB_MSG_DEFAULT, _("Can't scan directory\n" " '%s'\nopendir() returned: '%s'\n"), utf8, strerror(errno)); free(utf8); } @@ -133,7 +135,7 @@ char *utf8 = NULL; utf8_dup_string(&utf8, DirName); - Message(_("Can't change working directory to\n" " '%s'\nchdir() returned: '%s'\n"), utf8, strerror(errno)); + Message(PCB_MSG_DEFAULT, _("Can't change working directory to\n" " '%s'\nchdir() returned: '%s'\n"), utf8, strerror(errno)); free(utf8); } Index: trunk/src/error.h =================================================================== --- trunk/src/error.h (revision 3044) +++ trunk/src/error.h (revision 3045) @@ -29,12 +29,25 @@ #ifndef PCB_ERROR_H #define PCB_ERROR_H - +// Common return codes. #define STATUS_OK 0 #define STATUS_BREAK 1 #define STATUS_ERROR -1 -void Message(const char *Format, ...); +enum pcb_message_level { + // MSG_DEFAULT is the default level when a message is not converted yet + // to any of the levels below. This level will go away once all messages + // are converted. Please grep for this and convert the message to the + // more specific. + PCB_MSG_DEFAULT = 1, + + PCB_MSG_DEBUG = 0, // Debug message. Should probably not be shown in regular operation. + PCB_MSG_INFO, // Info message. FYI for the user, no action needed. + PCB_MSG_WARNING, // Something the user should probably take note + PCB_MSG_ERROR, // Couldn't finish an action, needs user attention. +}; + +void Message(enum pcb_message_level level, const char *Format, ...); void MyFatal(const char *Format, ...); void OpenErrorMessage(const char *); void PopenErrorMessage(const char *); Index: trunk/src/event.c =================================================================== --- trunk/src/event.c (revision 3044) +++ trunk/src/event.c (revision 3045) @@ -101,7 +101,7 @@ va_start(ap, fmt); for (a++; *fmt != '\0'; fmt++, a++, argc++) { if (argc >= EVENT_MAX_ARG) { - Message("event(): too many arguments\n"); + Message(PCB_MSG_DEFAULT, "event(): too many arguments\n"); break; } switch (*fmt) { @@ -120,7 +120,7 @@ default: a->type = ARG_INT; a->d.i = 0; - Message("event(): invalid argument type '%c'\n", *fmt); + Message(PCB_MSG_DEFAULT, "event(): invalid argument type '%c'\n", *fmt); break; } } Index: trunk/src/find_act.c =================================================================== --- trunk/src/find_act.c (revision 3044) +++ trunk/src/find_act.c (revision 3045) @@ -48,7 +48,7 @@ int count; if (gui->drc_gui == NULL || gui->drc_gui->log_drc_overview) { - Message(_("%m+Rules are minspace %$mS, minoverlap %$mS " + Message(PCB_MSG_DEFAULT, _("%m+Rules are minspace %$mS, minoverlap %$mS " "minwidth %$mS, minsilk %$mS\n" "min drill %$mS, min annular ring %$mS\n"), conf_core.editor.grid_unit->allow, PCB->Bloat, PCB->Shrink, PCB->minWid, PCB->minSlk, PCB->minDrill, PCB->minRing); @@ -56,11 +56,11 @@ count = DRCAll(); if (gui->drc_gui == NULL || gui->drc_gui->log_drc_overview) { if (count == 0) - Message(_("No DRC problems found.\n")); + Message(PCB_MSG_DEFAULT, _("No DRC problems found.\n")); else if (count > 0) - Message(_("Found %d design rule errors.\n"), count); + Message(PCB_MSG_DEFAULT, _("Found %d design rule errors.\n"), count); else - Message(_("Aborted DRC after %d design rule errors.\n"), -count); + Message(PCB_MSG_DEFAULT, _("Aborted DRC after %d design rule errors.\n"), -count); } return 0; } Index: trunk/src/find_drc.c =================================================================== --- trunk/src/find_drc.c (revision 3044) +++ trunk/src/find_drc.c (revision 3045) @@ -181,8 +181,8 @@ } if (gui->drc_gui == NULL || gui->drc_gui->log_drc_violations) { - Message(_("WARNING! Design Rule error - %s\n"), violation->title); - Message(_("%m+near location %$mD\n"), conf_core.editor.grid_unit->allow, violation->x, violation->y); + Message(PCB_MSG_DEFAULT, _("WARNING! Design Rule error - %s\n"), violation->title); + Message(PCB_MSG_DEFAULT, _("%m+near location %$mD\n"), conf_core.editor.grid_unit->allow, violation->x, violation->y); } } @@ -273,7 +273,7 @@ } break; default: - Message("hace: Bad Plow object in callback\n"); + Message(PCB_MSG_DEFAULT, "hace: Bad Plow object in callback\n"); } return R_DIR_NOT_FOUND; @@ -683,7 +683,7 @@ gui->invalidate_all(); if (nopastecnt > 0) { - Message(_("Warning: %d pad%s the nopaste flag set.\n"), nopastecnt, nopastecnt > 1 ? "s have" : " has"); + Message(PCB_MSG_DEFAULT, _("Warning: %d pad%s the nopaste flag set.\n"), nopastecnt, nopastecnt > 1 ? "s have" : " has"); } return IsBad ? -drcerr_count : drcerr_count; } Index: trunk/src/find_lookup.c =================================================================== --- trunk/src/find_lookup.c (revision 3044) +++ trunk/src/find_lookup.c (revision 3045) @@ -481,7 +481,7 @@ /* try all new pads */ layer -= max_copper_layer; if (layer > 1) { - Message(_("bad layer number %d max_copper_layer=%d in find.c\n"), layer, max_copper_layer); + Message(PCB_MSG_DEFAULT, _("bad layer number %d max_copper_layer=%d in find.c\n"), layer, max_copper_layer); return false; } position = &padposition[layer]; @@ -519,9 +519,9 @@ SET_FLAG(PCB_FLAG_WARN, pin); conf_core.temp.rat_warn = true; if (pin->Element) - Message(_("WARNING: Hole too close to pin.\n")); + Message(PCB_MSG_DEFAULT, _("WARNING: Hole too close to pin.\n")); else - Message(_("WARNING: Hole too close to via.\n")); + Message(PCB_MSG_DEFAULT, _("WARNING: Hole too close to via.\n")); } else if (ADD_PV_TO_LIST(pin, PCB_TYPE_PIN, &i->pv, FCT_COPPER)) longjmp(i->env, 1); @@ -597,7 +597,7 @@ if (TEST_FLAG(PCB_FLAG_HOLE, pv)) { SET_FLAG(PCB_FLAG_WARN, pv); conf_core.temp.rat_warn = true; - Message(_("WARNING: Hole too close to line.\n")); + Message(PCB_MSG_DEFAULT, _("WARNING: Hole too close to line.\n")); } else if (ADD_PV_TO_LIST(pv, PCB_TYPE_LINE, &i->line, FCT_COPPER)) longjmp(i->env, 1); @@ -614,7 +614,7 @@ if (TEST_FLAG(PCB_FLAG_HOLE, pv)) { SET_FLAG(PCB_FLAG_WARN, pv); conf_core.temp.rat_warn = true; - Message(_("WARNING: Hole too close to pad.\n")); + Message(PCB_MSG_DEFAULT, _("WARNING: Hole too close to pad.\n")); } else if (ADD_PV_TO_LIST(pv, PCB_TYPE_PAD, &i->pad, FCT_COPPER)) longjmp(i->env, 1); @@ -631,7 +631,7 @@ if (TEST_FLAG(PCB_FLAG_HOLE, pv)) { SET_FLAG(PCB_FLAG_WARN, pv); conf_core.temp.rat_warn = true; - Message(_("WARNING: Hole touches arc.\n")); + Message(PCB_MSG_DEFAULT, _("WARNING: Hole touches arc.\n")); } else if (ADD_PV_TO_LIST(pv, PCB_TYPE_ARC, &i->arc, FCT_COPPER)) longjmp(i->env, 1); Index: trunk/src/global.h =================================================================== --- trunk/src/global.h (revision 3044) +++ trunk/src/global.h (revision 3045) @@ -536,8 +536,8 @@ * Macros called by various action routines to show usage or to report * a syntax error and fail */ -#define AUSAGE(x) Message ("Usage:\n%s\n", (x##_syntax)) -#define AFAIL(x) { Message ("Syntax error. Usage:\n%s\n", (x##_syntax)); return 1; } +#define AUSAGE(x) Message (PCB_MSG_INFO, "Usage:\n%s\n", (x##_syntax)) +#define AFAIL(x) { Message (PCB_MSG_ERROR, "Syntax error. Usage:\n%s\n", (x##_syntax)); return 1; } /* Make sure to catch usage of non-portable functions in debug mode */ #ifndef NDEBUG Index: trunk/src/gui_act.c =================================================================== --- trunk/src/gui_act.c (revision 3044) +++ trunk/src/gui_act.c (revision 3045) @@ -869,8 +869,8 @@ AFAIL(message); for (i = 0; i < argc; i++) { - Message(argv[i]); - Message("\n"); + Message(PCB_MSG_DEFAULT, argv[i]); + Message(PCB_MSG_DEFAULT, "\n"); } return 0; @@ -1025,7 +1025,7 @@ hid_action("RouteStylesChanged"); } else - Message("Error: invalid route style name or index\n"); + Message(PCB_MSG_DEFAULT, "Error: invalid route style name or index\n"); } return 0; } @@ -1042,7 +1042,7 @@ static int ActionCreateMenu(int argc, char **argv, Coord x, Coord y) { if (gui == NULL) { - Message("Error: can't create menu, there's no GUI hid loaded\n"); + Message(PCB_MSG_DEFAULT, "Error: can't create menu, there's no GUI hid loaded\n"); return 1; } @@ -1152,7 +1152,7 @@ int chg; if (ng == NULL) { - Message("No such HID."); + Message(PCB_MSG_DEFAULT, "No such HID."); return 1; } Index: trunk/src/hid_actions.c =================================================================== --- trunk/src/hid_actions.c (revision 3044) +++ trunk/src/hid_actions.c (revision 3045) @@ -56,11 +56,11 @@ for (i = 0; i < n; i++) { if (check_action_name(a[i].name)) { - Message(_("ERROR! Invalid action name, " "action \"%s\" not registered.\n"), a[i].name); + Message(PCB_MSG_DEFAULT, _("ERROR! Invalid action name, " "action \"%s\" not registered.\n"), a[i].name); continue; } if (htsp_get(all_actions, a[i].name) != NULL) { - Message(_("ERROR! Invalid action name, " "action \"%s\" is already registered.\n"), a[i].name); + Message(PCB_MSG_DEFAULT, _("ERROR! Invalid action name, " "action \"%s\" is already registered.\n"), a[i].name); continue; } ca = malloc(sizeof(hid_cookie_action_t)); @@ -135,7 +135,7 @@ return ca->action; if (!action_legal_unknown(name)) - Message("unknown action `%s'\n", name); + Message(PCB_MSG_DEFAULT, "unknown action `%s'\n", name); return 0; } @@ -257,10 +257,10 @@ int i; if (action_legal_unknown(name)) return 1; - Message("no action %s(", name); + Message(PCB_MSG_DEFAULT, "no action %s(", name); for (i = 0; i < argc; i++) - Message("%s%s", i ? ", " : "", argv[i]); - Message(")\n"); + Message(PCB_MSG_DEFAULT, "%s%s", i ? ", " : "", argv[i]); + Message(PCB_MSG_DEFAULT, ")\n"); return 1; } return hid_actionv_(a, argc, argv); @@ -324,8 +324,8 @@ sp++; } else if (require_parens) { - Message(_("Syntax error: %s\n"), rstr); - Message(_(" expected: Action(arg1, arg2)")); + Message(PCB_MSG_DEFAULT, _("Syntax error: %s\n"), rstr); + Message(PCB_MSG_DEFAULT, _(" expected: Action(arg1, arg2)")); retcode = 1; goto cleanup; } Index: trunk/src/hid_cfg.c =================================================================== --- trunk/src/hid_cfg.c (revision 3044) +++ trunk/src/hid_cfg.c (revision 3045) @@ -144,7 +144,7 @@ const char *fn; int line, col; lht_dom_loc_active(doc, &fn, &line, &col); - Message("Resource error: %s (%s:%d.%d)*\n", lht_err_str(err), filename, line+1, col+1); + Message(PCB_MSG_DEFAULT, "Resource error: %s (%s:%d.%d)*\n", lht_err_str(err), filename, line+1, col+1); return 1; } @@ -248,7 +248,7 @@ sprintf(end, "pcb-menu-%s.lht", fn); doc = hid_cfg_load_lht(*p); if (doc != NULL) - Message("Loaded menu file '%s'\n", *p); + Message(PCB_MSG_DEFAULT, "Loaded menu file '%s'\n", *p); } free(*p); } Index: trunk/src/hid_cfg.h =================================================================== --- trunk/src/hid_cfg.h (revision 3044) +++ trunk/src/hid_cfg.h (revision 3045) @@ -79,11 +79,11 @@ just a wrapper around lht_tree_path_ */ lht_node_t *hid_cfg_menu_field_path(const lht_node_t *parent, const char *path); -/* Return a text field of a submenu; return NULL and generate a Message() if +/* Return a text field of a submenu; return NULL and generate a Message(PCB_MSG_DEFAULT, ) if the given field is not text */ const char *hid_cfg_menu_field_str(const lht_node_t *submenu, hid_cfg_menufield_t field); -/* Return non-zero if submenu has further submenus; generate Message() if +/* Return non-zero if submenu has further submenus; generate Message(PCB_MSG_DEFAULT, ) if there is a submenu field with the wrong lihata type */ int hid_cfg_has_submenus(const lht_node_t *submenu); @@ -110,7 +110,7 @@ char *__end__; \ __end__ = hid_cfg_error_shared + sprintf(hid_cfg_error_shared, "Error in lihata node %s:%d.%d:", node->file_name, node->line, node->col); \ __end__ += sprintf(__end__, __VA_ARGS__); \ - Message(hid_cfg_error_shared); \ + Message(PCB_MSG_DEFAULT, hid_cfg_error_shared); \ } while(0) #endif Index: trunk/src/hid_cfg_input.c =================================================================== --- trunk/src/hid_cfg_input.c (revision 3044) +++ trunk/src/hid_cfg_input.c (revision 3045) @@ -54,7 +54,7 @@ else if ((vlen >= 7) && (strncasecmp(value, "release", 7) == 0)) m |= M_Release; else if ((vlen >= 5) && (strncasecmp(value, "press", 5) == 0)) press = 1; else - Message("Unkown modifier: %s\n", value); + Message(PCB_MSG_DEFAULT, "Unkown modifier: %s\n", value); /* skip to next word */ next = strpbrk(value, "<- \t"); if (next == NULL) @@ -70,7 +70,7 @@ *last = value; if (press && (m & M_Release)) - Message("Bogus modifier: both press and release\n"); + Message(PCB_MSG_DEFAULT, "Bogus modifier: both press and release\n"); return m; } @@ -90,7 +90,7 @@ else if (strcasecmp(name, "scroll-left") == 0) return MB_SCROLL_UP; else if (strcasecmp(name, "scroll-right") == 0) return MB_SCROLL_DOWN; else { - Message("Error: unknown mouse button: %s\n", name); + Message(PCB_MSG_DEFAULT, "Error: unknown mouse button: %s\n", name); return 0; } } @@ -106,7 +106,7 @@ mouse->mouse = hid_cfg_get_menu(hr, "/mouse"); if (mouse->mouse == NULL) { - Message("Warning: no /mouse section in the resource file - mouse is disabled\n"); + Message(PCB_MSG_DEFAULT, "Warning: no /mouse section in the resource file - mouse is disabled\n"); return -1; } @@ -226,7 +226,7 @@ return *desc; if (len > sizeof(tmp)-1) { - Message("key sym name too long\n"); + Message(PCB_MSG_DEFAULT, "key sym name too long\n"); return 0; } strncpy(tmp, desc, len); @@ -272,13 +272,13 @@ k = strchr(last, '<'); if (k == NULL) { - Message("Missing in the key description: '%s'\n", keydesc); + Message(PCB_MSG_DEFAULT, "Missing in the key description: '%s'\n", keydesc); return -1; } len -= k-last; k++; len--; if ((strncmp(k, "key>", 4) != 0) && (strncmp(k, "Key>", 4) != 0)) { - Message("Missing in the key description\n"); + Message(PCB_MSG_DEFAULT, "Missing in the key description\n"); return -1; } k+=4; len-=4; @@ -289,7 +289,7 @@ s = malloc(len+1); memcpy(s, k, len); s[len] = '\0'; - Message("Unrecognised key symbol in key description: %s\n", s); + Message(PCB_MSG_DEFAULT, "Unrecognised key symbol in key description: %s\n", s); free(s); return -1; } Index: trunk/src/hid_flags.c =================================================================== --- trunk/src/hid_flags.c (revision 3044) +++ trunk/src/hid_flags.c (revision 3045) @@ -41,7 +41,7 @@ int len; len = cp - name; if (len > sizeof(buff)-1) { - Message("hid_get_flag: action name too long: %s()\n", name); + Message(PCB_MSG_DEFAULT, "hid_get_flag: action name too long: %s()\n", name); return -1; } memcpy(buff, name, len); @@ -48,7 +48,7 @@ buff[len] = '\0'; a = hid_find_action(buff); if (!a) { - Message("hid_get_flag: no action %s\n", name); + Message(PCB_MSG_DEFAULT, "hid_get_flag: no action %s\n", name); return -1; } cp++; @@ -55,7 +55,7 @@ len = strlen(cp); end = strchr(cp, ')'); if ((len > sizeof(buff)-1) || (end == NULL)) { - Message("hid_get_flag: action arg too long or unterminated: %s\n", name); + Message(PCB_MSG_DEFAULT, "hid_get_flag: action arg too long or unterminated: %s\n", name); return -1; } len = end - cp; Index: trunk/src/main.c =================================================================== --- trunk/src/main.c (revision 3044) +++ trunk/src/main.c (revision 3045) @@ -387,7 +387,7 @@ case DO_GUI: gui = hid_find_gui(argv[2]); if (gui == NULL) { - Message("Can't find the gui requested.\n"); + Message(PCB_MSG_DEFAULT, "Can't find the gui requested.\n"); exit(1); } break; @@ -405,7 +405,7 @@ /* try anything */ if (gui == NULL) { - Message("Warning: can't find any of the preferred GUIs, falling back to anything available...\n"); + Message(PCB_MSG_DEFAULT, "Warning: can't find any of the preferred GUIs, falling back to anything available...\n"); gui = hid_find_gui(NULL); } } @@ -434,7 +434,7 @@ PCB = CreateNewPCB(); if (PCB == NULL) { - Message("Can't load the default pcb for creating an empty layout\n"); + Message(PCB_MSG_DEFAULT, "Can't load the default pcb for creating an empty layout\n"); exit(1); } @@ -470,11 +470,11 @@ hid_action("LibraryChanged"); if (conf_core.rc.script_filename) { - Message(_("Executing startup script file %s\n"), conf_core.rc.script_filename); + Message(PCB_MSG_DEFAULT, _("Executing startup script file %s\n"), conf_core.rc.script_filename); hid_actionl("ExecuteFile", conf_core.rc.script_filename, NULL); } if (conf_core.rc.action_string) { - Message(_("Executing startup action %s\n"), conf_core.rc.action_string); + Message(PCB_MSG_DEFAULT, _("Executing startup action %s\n"), conf_core.rc.action_string); hid_parse_actions(conf_core.rc.action_string); } Index: trunk/src/misc.c =================================================================== --- trunk/src/misc.c (revision 3044) +++ trunk/src/misc.c (revision 3045) @@ -782,7 +782,7 @@ case PCB_TYPE_LINE_POINT: return (BoxType *) Ptr3; default: - Message("Request for bounding box of unsupported type %d\n", Type); + Message(PCB_MSG_DEFAULT, "Request for bounding box of unsupported type %d\n", Type); return (BoxType *) Ptr2; } } Index: trunk/src/move.c =================================================================== --- trunk/src/move.c (revision 3044) +++ trunk/src/move.c (revision 3045) @@ -426,7 +426,7 @@ ArcTypePtr newone; if (TEST_FLAG(PCB_FLAG_LOCK, Arc)) { - Message(_("Sorry, the object is locked\n")); + Message(PCB_MSG_DEFAULT, _("Sorry, the object is locked\n")); return NULL; } if (Dest == Layer && Layer->On) { @@ -506,7 +506,7 @@ void *ptr1, *ptr2, *ptr3; if (TEST_FLAG(PCB_FLAG_LOCK, Line)) { - Message(_("Sorry, the object is locked\n")); + Message(PCB_MSG_DEFAULT, _("Sorry, the object is locked\n")); return NULL; } if (Dest == Layer && Layer->On) { @@ -590,7 +590,7 @@ static void *MoveTextToLayer(LayerType * layer, TextType * text) { if (TEST_FLAG(PCB_FLAG_LOCK, text)) { - Message(_("Sorry, the object is locked\n")); + Message(PCB_MSG_DEFAULT, _("Sorry, the object is locked\n")); return NULL; } if (Dest != layer) { @@ -653,7 +653,7 @@ struct mptlc d; if (TEST_FLAG(PCB_FLAG_LOCK, Polygon)) { - Message(_("Sorry, the object is locked\n")); + Message(PCB_MSG_DEFAULT, _("Sorry, the object is locked\n")); return NULL; } if (((long int) Dest == -1) || (Layer == Dest)) @@ -832,11 +832,11 @@ IncrementUndoSerialNumber(); if (old_index < -1 || old_index >= max_copper_layer) { - Message("Invalid old layer %d for move: must be -1..%d\n", old_index, max_copper_layer - 1); + Message(PCB_MSG_DEFAULT, "Invalid old layer %d for move: must be -1..%d\n", old_index, max_copper_layer - 1); return 1; } if (new_index < -1 || new_index > max_copper_layer || new_index >= MAX_LAYER) { - Message("Invalid new layer %d for move: must be -1..%d\n", new_index, max_copper_layer); + Message(PCB_MSG_DEFAULT, "Invalid new layer %d for move: must be -1..%d\n", new_index, max_copper_layer); return 1; } if (old_index == new_index) @@ -862,7 +862,7 @@ if (old_index == -1) { LayerTypePtr lp; if (max_copper_layer == MAX_LAYER) { - Message("No room for new layers\n"); + Message(PCB_MSG_DEFAULT, "No room for new layers\n"); return 1; } /* Create a new layer at new_index. */ @@ -991,7 +991,7 @@ int new_top = -1; if (argc != 2) { - Message("Usage; MoveLayer(old,new)"); + Message(PCB_MSG_DEFAULT, "Usage; MoveLayer(old,new)"); return 1; } Index: trunk/src/netlist.c =================================================================== --- trunk/src/netlist.c (revision 3044) +++ trunk/src/netlist.c (revision 3045) @@ -213,7 +213,7 @@ int le, lp; if (next > 2) { - Message("Exactly two pins should be selected for swap (more than 2 selected at the moment)\n"); + Message(PCB_MSG_DEFAULT, "Exactly two pins should be selected for swap (more than 2 selected at the moment)\n"); goto quit; } @@ -229,7 +229,7 @@ END_LOOP; if (next < 2) { - Message("Exactly two pins should be selected for swap (less than 2 selected at the moment)\n"); + Message(PCB_MSG_DEFAULT, "Exactly two pins should be selected for swap (less than 2 selected at the moment)\n"); goto quit; } @@ -237,11 +237,11 @@ nets[0] = rats_patch_find_net4pin(PCB, pins[0]); nets[1] = rats_patch_find_net4pin(PCB, pins[1]); if ((nets[0] == NULL) || (nets[1] == NULL)) { - Message("That pin is not on a net.\n"); + Message(PCB_MSG_DEFAULT, "That pin is not on a net.\n"); goto quit; } if (nets[0] == nets[1]) { - Message("Those two pins are on the same net, can't swap them.\n"); + Message(PCB_MSG_DEFAULT, "Those two pins are on the same net, can't swap them.\n"); goto quit; } @@ -369,7 +369,7 @@ if (!PCB) return 1; if (argc == 0) { - Message(netlist_syntax); + Message(PCB_MSG_DEFAULT, netlist_syntax); return 1; } if (strcasecmp(argv[0], "find") == 0) @@ -418,7 +418,7 @@ return 0; } else { - Message(netlist_syntax); + Message(PCB_MSG_DEFAULT, netlist_syntax); return 1; } @@ -432,7 +432,7 @@ if (use_re) { regex = re_sei_comp(argv[1]); if (re_sei_errno(regex) != 0) { - Message(_("regexp error: %s\n"), re_error_str(re_sei_errno(regex))); + Message(PCB_MSG_DEFAULT, _("regexp error: %s\n"), re_error_str(re_sei_errno(regex))); re_sei_free(regex); return (1); } Index: trunk/src/object_act.c =================================================================== --- trunk/src/object_act.c (revision 3044) +++ trunk/src/object_act.c (revision 3045) @@ -116,7 +116,7 @@ AFAIL(attributes); if (!gui->edit_attributes) { - Message(_("This GUI doesn't support Attribute Editing\n")); + Message(PCB_MSG_DEFAULT, _("This GUI doesn't support Attribute Editing\n")); return 1; } @@ -139,7 +139,7 @@ break; } if (layer == NULL) { - Message(_("No layer named %s\n"), layername); + Message(PCB_MSG_DEFAULT, _("No layer named %s\n"), layername); return 1; } } @@ -163,7 +163,7 @@ } END_LOOP; if (n_found > 1) { - Message(_("Too many elements selected\n")); + Message(PCB_MSG_DEFAULT, _("Too many elements selected\n")); return 1; } if (n_found == 0) { @@ -172,7 +172,7 @@ if ((SearchScreen(x, y, PCB_TYPE_ELEMENT, &ptrtmp, &ptrtmp, &ptrtmp)) != PCB_TYPE_NONE) e = (ElementTypePtr) ptrtmp; else { - Message(_("No element found there\n")); + Message(PCB_MSG_DEFAULT, _("No element found there\n")); return 1; } } @@ -387,7 +387,7 @@ type = SearchScreen(x, y, MOVE_TYPES, &ptr1, &ptr2, &ptr3); if (type == PCB_TYPE_NONE) { - Message(_("Nothing found under crosshair\n")); + Message(PCB_MSG_DEFAULT, _("Nothing found under crosshair\n")); return 1; } if (absolute1) @@ -684,7 +684,7 @@ END_LOOP; if (!e) { - Message(_("Cannot change attribute of %s - element not found\n"), refdes); + Message(PCB_MSG_DEFAULT, _("Cannot change attribute of %s - element not found\n"), refdes); return 1; } Index: trunk/src/paths.c =================================================================== --- trunk/src/paths.c (revision 3044) +++ trunk/src/paths.c (revision 3045) @@ -16,7 +16,7 @@ if (**in == '~') { int l1, l2; if (conf_core.rc.path.home == NULL) { - Message("can't resolve home dir required for path %s\n", *in); + Message(PCB_MSG_DEFAULT, "can't resolve home dir required for path %s\n", *in); exit(1); } subst_to = conf_core.rc.path.home; @@ -57,7 +57,7 @@ } } } - Message("can't resolve conf-hash dir required for path %s\n", *in); + Message(PCB_MSG_DEFAULT, "can't resolve conf-hash dir required for path %s\n", *in); *out = NULL; } else Index: trunk/src/plug_footprint.c =================================================================== --- trunk/src/plug_footprint.c (revision 3044) +++ trunk/src/plug_footprint.c (revision 3045) @@ -357,7 +357,7 @@ if (res >= 0) n_footprints += res; else - Message("Warning: footprint library list error on %s\n", toppath); + Message(PCB_MSG_DEFAULT, "Warning: footprint library list error on %s\n", toppath); } #ifdef DEBUG Index: trunk/src/plug_import.c =================================================================== --- trunk/src/plug_import.c (revision 3044) +++ trunk/src/plug_import.c (revision 3045) @@ -93,7 +93,7 @@ FILE *fp; if (!filename) { - Message("Error: need a file name for ImportNetlist()\n"); + Message(PCB_MSG_DEFAULT, "Error: need a file name for ImportNetlist()\n"); return (1); /* nothing to do */ } fp = fopen(filename, "r"); @@ -101,11 +101,11 @@ plug = find_importer(aspect, fp, filename); if (plug == NULL) { if (fp != NULL) { - Message("Error: can't find a suitable netlist parser for %s\n", filename); + Message(PCB_MSG_DEFAULT, "Error: can't find a suitable netlist parser for %s\n", filename); fclose(fp); } else - Message("Error: can't find a suitable netlist parser for %s - might be related: can't open %s for reading\n", filename, filename); + Message(PCB_MSG_DEFAULT, "Error: can't find a suitable netlist parser for %s - might be related: can't open %s for reading\n", filename, filename); return 1; } Index: trunk/src/plug_io.c =================================================================== --- trunk/src/plug_io.c (revision 3044) +++ trunk/src/plug_io.c (revision 3045) @@ -103,7 +103,7 @@ if (filename == NULL) filename = ""; } - Message("IO error during %s: %s %s %s\n", what, reason, filename, comment); + Message(PCB_MSG_DEFAULT, "IO error during %s: %s %s %s\n", what, reason, filename, comment); } } @@ -119,7 +119,7 @@ int len; len = find_io(available, sizeof(available)/sizeof(available[0]), PCB_IOT_PCB, 0, fmt); if (len <= 0) { - Message("Error: can't find a IO_ plugin to load a PCB using format %s\n", fmt); + Message(PCB_MSG_DEFAULT, "Error: can't find a IO_ plugin to load a PCB using format %s\n", fmt); return -1; } res = available[0].plug->parse_pcb(available[0].plug, Ptr, Filename, load_settings); @@ -307,7 +307,7 @@ /* enable default font if necessary */ if (!PCB->Font.Valid) { if (require_font) - Message(_("File '%s' has no font information, using default font\n"), new_filename); + Message(PCB_MSG_DEFAULT, _("File '%s' has no font information, using default font\n"), new_filename); PCB->Font.Valid = true; } @@ -354,7 +354,7 @@ /* bozo: we are trying to revert back to a non-existing pcb... create one to avoid a segfault */ PCB = CreateNewPCB_(false); if (PCB == NULL) { - Message("FATAL: can't create a new empty pcb!"); + Message(PCB_MSG_DEFAULT, "FATAL: can't create a new empty pcb!"); exit(1); } } @@ -600,7 +600,7 @@ /* memory might have been released before this function is called */ if (PCB && PCB->Changed) { sprintf(filename, conf_core.rc.emergency_name, pcb_getpid()); - Message(_("Trying to save your layout in '%s'\n"), filename); + Message(PCB_MSG_DEFAULT, _("Trying to save your layout in '%s'\n"), filename); WritePCBFile(filename, DEFAULT_FMT); } } @@ -782,7 +782,7 @@ if (EMPTY_STRING_P(conf_core.rc.save_command)) { fp = fopen(Filename, "w"); if (fp == 0) { - Message("Unable to write to file %s\n", Filename); + Message(PCB_MSG_DEFAULT, "Unable to write to file %s\n", Filename); return STATUS_ERROR; } } Index: trunk/src/polygon.c =================================================================== --- trunk/src/polygon.c (revision 3044) +++ trunk/src/polygon.c (revision 3045) @@ -727,7 +727,7 @@ p->Clipped = biggest(merged); assert(!p->Clipped || poly_Valid(p->Clipped)); if (!p->Clipped) - Message("Polygon cleared out of existence near (%d, %d)\n", + Message(PCB_MSG_DEFAULT, "Polygon cleared out of existence near (%d, %d)\n", (p->BoundingBox.X1 + p->BoundingBox.X2) / 2, (p->BoundingBox.Y1 + p->BoundingBox.Y2) / 2); return 1; } @@ -1316,7 +1316,7 @@ dx = coord_abs(Crosshair.AttachedPolygon.Points[n - 1].X - Crosshair.AttachedPolygon.Points[0].X); dy = coord_abs(Crosshair.AttachedPolygon.Points[n - 1].Y - Crosshair.AttachedPolygon.Points[0].Y); if (!(dx == 0 || dy == 0 || dx == dy)) { - Message(_("Cannot close polygon because 45 degree lines are requested.\n")); + Message(PCB_MSG_DEFAULT, _("Cannot close polygon because 45 degree lines are requested.\n")); return; } } @@ -1324,7 +1324,7 @@ Draw(); } else - Message(_("A polygon has to have at least 3 points\n")); + Message(PCB_MSG_DEFAULT, _("A polygon has to have at least 3 points\n")); } /* --------------------------------------------------------------------------- Index: trunk/src/rats.c =================================================================== --- trunk/src/rats.c (revision 3044) +++ trunk/src/rats.c (revision 3045) @@ -91,7 +91,7 @@ } else { ElementName[j] = '\0'; - Message(_("Bad net-list format encountered near: \"%s\"\n"), ElementName); + Message(PCB_MSG_DEFAULT, _("Bad net-list format encountered near: \"%s\"\n"), ElementName); return (true); } } @@ -157,7 +157,7 @@ return (false); for (j = 0; PinNum[j] != '\0'; j++); if (j == 0) { - Message(_("Error! Netlist file is missing pin!\n" "white space after \"%s-\"\n"), ElementName); + Message(PCB_MSG_DEFAULT, _("Error! Netlist file is missing pin!\n" "white space after \"%s-\"\n"), ElementName); badnet = true; } else { @@ -166,11 +166,11 @@ if (Same) return (false); if (PinNum[j - 1] < '0' || PinNum[j - 1] > '9') { - Message("WARNING! Pin number ending with '%c'" + Message(PCB_MSG_DEFAULT, "WARNING! Pin number ending with '%c'" " encountered in netlist file\n" "Probably a bad netlist file format\n", PinNum[j - 1]); } } - Message(_("Can't find %s pin %s called for in netlist.\n"), ElementName, PinNum); + Message(PCB_MSG_DEFAULT, _("Can't find %s pin %s called for in netlist.\n"), ElementName, PinNum); return (false); } @@ -227,7 +227,7 @@ { if (SeekPad(entry, &LastPoint, false)) { if (TEST_FLAG(PCB_FLAG_DRC, (PinTypePtr) LastPoint.ptr2)) - Message(_ + Message(PCB_MSG_DEFAULT, _ ("Error! Element %s pin %s appears multiple times in the netlist file.\n"), NAMEONPCB_NAME((ElementTypePtr) LastPoint.ptr1), (LastPoint.type == @@ -320,7 +320,7 @@ if ((TEST_FLAG(PCB_FLAG_DRC, pin)) && (!(e->Flags.f & PCB_FLAG_NONETLIST))) { warn = true; if (!pin->Spare) { - Message(_("Warning! Net \"%s\" is shorted to %s pin %s\n"), + Message(PCB_MSG_DEFAULT, _("Warning! Net \"%s\" is shorted to %s pin %s\n"), &theNet->Name[2], UNKNOWN(NAMEONPCB_NAME(element)), UNKNOWN(pin->Number)); stub_rat_found_short(pin, NULL, &theNet->Name[2]); continue; @@ -337,7 +337,7 @@ if (newone) { menu = GetPointerMemory(generic); *menu = pin->Spare; - Message(_("Warning! Net \"%s\" is shorted to net \"%s\"\n"), + Message(PCB_MSG_DEFAULT, _("Warning! Net \"%s\" is shorted to net \"%s\"\n"), &theNet->Name[2], &((LibraryMenuTypePtr) (pin->Spare))->Name[2]); stub_rat_found_short(pin, NULL, &theNet->Name[2]); } @@ -351,7 +351,7 @@ if ((TEST_FLAG(PCB_FLAG_DRC, pad)) && (!(e->Flags.f & PCB_FLAG_NONETLIST)) && (!(e->Name->Flags.f & PCB_FLAG_NONETLIST))) { warn = true; if (!pad->Spare) { - Message(_("Warning! Net \"%s\" is shorted to %s pad %s\n"), + Message(PCB_MSG_DEFAULT, _("Warning! Net \"%s\" is shorted to %s pad %s\n"), &theNet->Name[2], UNKNOWN(NAMEONPCB_NAME(element)), UNKNOWN(pad->Number)); stub_rat_found_short(NULL, pad, &theNet->Name[2]); continue; @@ -368,7 +368,7 @@ if (newone) { menu = GetPointerMemory(generic); *menu = pad->Spare; - Message(_("Warning! Net \"%s\" is shorted to net \"%s\"\n"), + Message(PCB_MSG_DEFAULT, _("Warning! Net \"%s\" is shorted to net \"%s\"\n"), &theNet->Name[2], &((LibraryMenuTypePtr) (pad->Spare))->Name[2]); stub_rat_found_short(NULL, pad, &theNet->Name[2]); } @@ -653,7 +653,7 @@ */ Wantlist = ProcNetlist(&(PCB->NetlistLib[NETLIST_EDITED])); if (!Wantlist) { - Message(_("Can't add rat lines because no netlist is loaded.\n")); + Message(PCB_MSG_DEFAULT, _("Can't add rat lines because no netlist is loaded.\n")); return (false); } changed = false; @@ -708,15 +708,15 @@ if (changed) { IncrementUndoSerialNumber(); if (ratlist_length(&PCB->Data->Rat) > 0) { - Message("%d rat line%s remaining\n", ratlist_length(&PCB->Data->Rat), ratlist_length(&PCB->Data->Rat) > 1 ? "s" : ""); + Message(PCB_MSG_DEFAULT, "%d rat line%s remaining\n", ratlist_length(&PCB->Data->Rat), ratlist_length(&PCB->Data->Rat) > 1 ? "s" : ""); } return (true); } if (!SelectedOnly && !Warned) { if (!ratlist_length(&PCB->Data->Rat) && !badnet) - Message(_("Congratulations!!\n" "The layout is complete and has no shorted nets.\n")); + Message(PCB_MSG_DEFAULT, _("Congratulations!!\n" "The layout is complete and has no shorted nets.\n")); else - Message(_("Nothing more to add, but there are\n" + Message(PCB_MSG_DEFAULT, _("Nothing more to add, but there are\n" "either rat-lines in the layout, disabled nets\n" "in the net-list, or missing components\n")); } return (false); @@ -739,7 +739,7 @@ */ Wantlist = ProcNetlist(&(PCB->NetlistLib[NETLIST_EDITED])); if (!Wantlist) { - Message(_("Can't add rat lines because no netlist is loaded.\n")); + Message(PCB_MSG_DEFAULT, _("Can't add rat lines because no netlist is loaded.\n")); return result; } /* initialize finding engine */ @@ -819,11 +819,11 @@ found = SearchObjectByLocation(PCB_TYPE_PAD | PCB_TYPE_PIN, &ptr1, &ptr2, &ptr3, Crosshair.AttachedLine.Point1.X, Crosshair.AttachedLine.Point1.Y, 5); if (found == PCB_TYPE_NONE) { - Message(_("No pad/pin under rat line\n")); + Message(PCB_MSG_DEFAULT, _("No pad/pin under rat line\n")); return (NULL); } if (NAMEONPCB_NAME((ElementTypePtr) ptr1) == NULL || *NAMEONPCB_NAME((ElementTypePtr) ptr1) == 0) { - Message(_("You must name the starting element first\n")); + Message(PCB_MSG_DEFAULT, _("You must name the starting element first\n")); return (NULL); } @@ -834,11 +834,11 @@ found = SearchObjectByLocation(PCB_TYPE_PAD | PCB_TYPE_PIN, &ptr1, &ptr2, &ptr3, Crosshair.AttachedLine.Point2.X, Crosshair.AttachedLine.Point2.Y, 5); if (found == PCB_TYPE_NONE) { - Message(_("No pad/pin under rat line\n")); + Message(PCB_MSG_DEFAULT, _("No pad/pin under rat line\n")); return (NULL); } if (NAMEONPCB_NAME((ElementTypePtr) ptr1) == NULL || *NAMEONPCB_NAME((ElementTypePtr) ptr1) == 0) { - Message(_("You must name the ending element first\n")); + Message(PCB_MSG_DEFAULT, _("You must name the ending element first\n")); return (NULL); } group2 = (TEST_FLAG(PCB_FLAG_ONSOLDER, (PadTypePtr) ptr2) ? @@ -848,7 +848,7 @@ menu = netnode_to_netname(name1); if (menu) { if (netnode_to_netname(name2)) { - Message(_("Both connections already in netlist - cannot merge nets\n")); + Message(PCB_MSG_DEFAULT, _("Both connections already in netlist - cannot merge nets\n")); return (NULL); } entry = GetLibraryEntryMemory(menu); Index: trunk/src/rats_patch.c =================================================================== --- trunk/src/rats_patch.c (revision 3044) +++ trunk/src/rats_patch.c (revision 3045) @@ -382,7 +382,7 @@ END_LOOP; if (!(found)) { - Message("ReplaceFootprint works on selected elements, please select elements first!\n"); + Message(PCB_MSG_DEFAULT, "ReplaceFootprint works on selected elements, please select elements first!\n"); return 1; } @@ -390,7 +390,7 @@ if (argc == 0) { fpname = gui->prompt_for("Footprint name", ""); if (fpname == NULL) { - Message("No footprint name supplied\n"); + Message(PCB_MSG_DEFAULT, "No footprint name supplied\n"); return 1; } } @@ -401,7 +401,7 @@ a[0] = fpname; a[1] = NULL; if (LoadFootprint(1, a, x, y) != 0) { - Message("Can't load footprint %s\n", fpname); + Message(PCB_MSG_DEFAULT, "Can't load footprint %s\n", fpname); return 1; } @@ -463,7 +463,7 @@ fn = argv[0]; f = fopen(fn, "w"); if (f == NULL) { - Message("Can't open netlist patch file %s for writing\n", fn); + Message(PCB_MSG_DEFAULT, "Can't open netlist patch file %s for writing\n", fn); return 1; } rats_patch_fexport(PCB, f, 0); Index: trunk/src/rotate.c =================================================================== --- trunk/src/rotate.c (revision 3044) +++ trunk/src/rotate.c (revision 3045) @@ -375,7 +375,7 @@ void *ptr1, *ptr2, *ptr3; if ((type = SearchScreen(X, Y, ROTATE_TYPES, &ptr1, &ptr2, &ptr3)) != PCB_TYPE_NONE) { if (TEST_FLAG(PCB_FLAG_LOCK, (ArcTypePtr) ptr2)) { - Message(_("Sorry, the object is locked\n")); + Message(PCB_MSG_DEFAULT, _("Sorry, the object is locked\n")); return; } Crosshair.AttachedObject.RubberbandN = 0; Index: trunk/src/route_style.c =================================================================== --- trunk/src/route_style.c (revision 3044) +++ trunk/src/route_style.c (revision 3045) @@ -77,7 +77,7 @@ if (len > sizeof(routeStyle->name)-1) { memcpy(routeStyle->name, Name, sizeof(routeStyle->name)-1); routeStyle->name[sizeof(routeStyle->name)-1] = '\0'; - Message("Route style name '%s' too long, truncated to '%s'\n", Name, routeStyle->name); + Message(PCB_MSG_DEFAULT, "Route style name '%s' too long, truncated to '%s'\n", Name, routeStyle->name); } else strcpy(routeStyle->name, Name); Index: trunk/src/rubberband.c =================================================================== --- trunk/src/rubberband.c (revision 3044) +++ trunk/src/rubberband.c (revision 3045) @@ -250,7 +250,7 @@ CreateNewRubberbandEntry(NULL, (LineTypePtr) rat, &rat->Point2); break; default: - Message("hace: bad rubber-rat lookup callback\n"); + Message(PCB_MSG_DEFAULT, "hace: bad rubber-rat lookup callback\n"); } return R_DIR_NOT_FOUND; } Index: trunk/src/search.c =================================================================== --- trunk/src/search.c (revision 3044) +++ trunk/src/search.c (revision 3045) @@ -1298,7 +1298,7 @@ } END_LOOP; - Message("hace: Internal error, search for ID %d failed\n", ID); + Message(PCB_MSG_DEFAULT, "hace: Internal error, search for ID %d failed\n", ID); return (PCB_TYPE_NONE); } Index: trunk/src/select.c =================================================================== --- trunk/src/select.c (revision 3044) +++ trunk/src/select.c (revision 3045) @@ -783,7 +783,7 @@ /* compile the regular expression */ regex = re_sei_comp(Pattern); if (re_sei_errno(regex) != 0) { - Message(_("regexp error: %s\n"), re_error_str(re_sei_errno(regex))); + Message(PCB_MSG_DEFAULT, _("regexp error: %s\n"), re_error_str(re_sei_errno(regex))); re_sei_free(regex); return (false); } Index: trunk/src/set.c =================================================================== --- trunk/src/set.c (revision 3044) +++ trunk/src/set.c (revision 3045) @@ -172,7 +172,7 @@ void RestoreMode(void) { if (mode_position == 0) { - Message("hace: underflow of restore mode\n"); + Message(PCB_MSG_DEFAULT, "hace: underflow of restore mode\n"); return; } SetMode(mode_stack[--mode_position]); @@ -202,7 +202,7 @@ if (Mode == PCB_MODE_ARC || Mode == PCB_MODE_RECTANGLE || Mode == PCB_MODE_VIA || Mode == PCB_MODE_POLYGON || Mode == PCB_MODE_POLYGON_HOLE || Mode == PCB_MODE_TEXT || Mode == PCB_MODE_INSERT_POINT || Mode == PCB_MODE_THERMAL) { - Message(_("That mode is NOT allowed when drawing ratlines!\n")); + Message(PCB_MSG_DEFAULT, _("That mode is NOT allowed when drawing ratlines!\n")); Mode = PCB_MODE_NO; } } Index: trunk/src/stub_stroke.c =================================================================== --- trunk/src/stub_stroke.c (revision 3044) +++ trunk/src/stub_stroke.c (revision 3045) @@ -30,7 +30,7 @@ static void stub_stroke_start_dummy(void) { - Message("Can not use libstroke: not compiled as a buildin and not loaded as a plugin\n"); + Message(PCB_MSG_DEFAULT, "Can not use libstroke: not compiled as a buildin and not loaded as a plugin\n"); } void (*stub_stroke_record)(int ev_x, int ev_y) = stub_stroke_record_dummy; Index: trunk/src/undo.c =================================================================== --- trunk/src/undo.c (revision 3044) +++ trunk/src/undo.c (revision 3045) @@ -183,7 +183,7 @@ #ifdef DEBUG_ID if (SearchObjectByID(PCB->Data, &ptr1, &ptr2, &ptr3, ID, Kind) == PCB_TYPE_NONE) - Message("hace: ID (%d) and Type (%x) mismatch in AddObject...\n", ID, Kind); + Message(PCB_MSG_DEFAULT, "hace: ID (%d) and Type (%x) mismatch in AddObject...\n", ID, Kind); #endif /* allocate memory */ @@ -199,7 +199,7 @@ if (size > limit) { size_t l2; l2 = (size / limit + 1) * limit; - Message(_("Size of 'undo-list' exceeds %li kb\n"), (long) (l2 >> 10)); + Message(PCB_MSG_DEFAULT, _("Size of 'undo-list' exceeds %li kb\n"), (long) (l2 >> 10)); } } @@ -502,8 +502,8 @@ DrawObject(type, ptr1, ptr2); return (true); } - Message("hace Internal error: Can't find ID %d type %08x\n", Entry->ID, Entry->Kind); - Message("for UndoFlag Operation. Previous flags: %s\n", flags_to_string(Entry->Data.Flags, 0)); + Message(PCB_MSG_DEFAULT, "hace Internal error: Can't find ID %d type %08x\n", Entry->ID, Entry->Kind); + Message(PCB_MSG_DEFAULT, "for UndoFlag Operation. Previous flags: %s\n", flags_to_string(Entry->Data.Flags, 0)); return (false); } @@ -527,7 +527,7 @@ DrawElement(element); return (true); } - Message("hace Internal error: UndoMirror on object type %d\n", type); + Message(PCB_MSG_DEFAULT, "hace Internal error: UndoMirror on object type %d\n", type); return (false); } @@ -855,12 +855,12 @@ andDraw = draw; if (Serial == 0) { - Message(_("ERROR: Attempt to Undo() with Serial == 0\n" " Please save your work and report this bug.\n")); + Message(PCB_MSG_DEFAULT, _("ERROR: Attempt to Undo() with Serial == 0\n" " Please save your work and report this bug.\n")); return 0; } if (UndoN == 0) { - Message(_("Nothing to undo - buffer is empty\n")); + Message(PCB_MSG_DEFAULT, _("Nothing to undo - buffer is empty\n")); return 0; } @@ -869,7 +869,7 @@ ptr = &UndoList[UndoN - 1]; if (ptr->Serial > Serial) { - Message(_("ERROR: Bad undo serial number %d in undo stack - expecting %d or lower\n" + Message(PCB_MSG_DEFAULT, _("ERROR: Bad undo serial number %d in undo stack - expecting %d or lower\n" " Please save your work and report this bug.\n"), ptr->Serial, Serial); /* It is likely that the serial number got corrupted through some bad @@ -896,7 +896,7 @@ UnlockUndo(); if (error_undoing) - Message(_("ERROR: Failed to undo some operations\n")); + Message(PCB_MSG_DEFAULT, _("ERROR: Failed to undo some operations\n")); if (Types && andDraw) Draw(); @@ -1032,7 +1032,7 @@ andDraw = draw; if (RedoN == 0) { - Message(_("Nothing to redo. Perhaps changes have been made since last undo\n")); + Message(PCB_MSG_DEFAULT, _("Nothing to redo. Perhaps changes have been made since last undo\n")); return 0; } @@ -1039,7 +1039,7 @@ ptr = &UndoList[UndoN]; if (ptr->Serial < Serial) { - Message(_("ERROR: Bad undo serial number %d in redo stack - expecting %d or higher\n" + Message(PCB_MSG_DEFAULT, _("ERROR: Bad undo serial number %d in redo stack - expecting %d or higher\n" " Please save your work and report this bug.\n"), ptr->Serial, Serial); /* It is likely that the serial number got corrupted through some bad @@ -1069,7 +1069,7 @@ UnlockUndo(); if (error_undoing) - Message(_("ERROR: Failed to redo some operations\n")); + Message(PCB_MSG_DEFAULT, _("ERROR: Failed to redo some operations\n")); if (Types && andDraw) Draw(); @@ -1083,7 +1083,7 @@ void RestoreUndoSerialNumber(void) { if (added_undo_between_increment_and_restore) - Message(_("ERROR: Operations were added to the Undo stack with an incorrect serial number\n")); + Message(PCB_MSG_DEFAULT, _("ERROR: Operations were added to the Undo stack with an incorrect serial number\n")); between_increment_and_restore = false; added_undo_between_increment_and_restore = false; Serial = SavedSerial;