diff --git a/src/belvuApp/belvu.cpp b/src/belvuApp/belvu.cpp index 7b23a1ae6f55e77eef29cac42deb106aedc9de09..7ab3f68069061fe57eab068b3e7abe4967a22d37 100644 --- a/src/belvuApp/belvu.cpp +++ b/src/belvuApp/belvu.cpp @@ -2501,8 +2501,8 @@ BelvuContext* createBelvuContext() bc->fileName = NULL; bc->dirName = NULL; bc->organismLabel[0] = 'O'; - bc->organismLabel[0] = 'S'; - bc->organismLabel[0] = '\0'; + bc->organismLabel[1] = 'S'; + bc->organismLabel[2] = '\0'; bc->conservCount = NULL; bc->colorMap = NULL; @@ -4416,7 +4416,6 @@ static void readMul(BelvuContext *bc, FILE *pipe) /* Store all annotation lines in a list. Prepend the items because that * is more efficient, and then reverse the list at the end */ bc->annotationList = g_slist_prepend(bc->annotationList, g_strdup(line)); - parseMulAnnotationLine(bc, line); } else if (!strncmp(line, "#=GC ", 5) || !strncmp(line, "#=GR ", 5) || @@ -4451,6 +4450,14 @@ static void readMul(BelvuContext *bc, FILE *pipe) g_slist_free(alnList); alnList = NULL; + + /* Loop through all the annotation lines and parse them (must be done after adding alignment + * lines) */ + for (GSList *annItem = bc->annotationList; annItem; annItem = annItem->next) + { + char *line = (char*)(annItem->data) ; + parseMulAnnotationLine(bc, line); + } /* For debugging * / for (i = 0; i < nseq; i++) { diff --git a/src/belvuApp/belvuMain.cpp b/src/belvuApp/belvuMain.cpp index ab695a74ec9d3784c2f32fef4dcb45e9fe0993e7..2e4475caddeeed84988c0fe1c3b1dd3b3ec7afa1 100644 --- a/src/belvuApp/belvuMain.cpp +++ b/src/belvuApp/belvuMain.cpp @@ -550,6 +550,8 @@ int main(int argc, char **argv) * There are two handlers: the default one for all non-critical messages, which will just log * output to the console, and one for critical messages and errors, which will display a * pop-up message (the idea being that we don't bother the user unless it's something serious). + * Note that the latter needs to display a gtk dialog so can't be set up until after gtk_init + * has been called. * * All errors and warnings will be sent to stderr, as will info messages (g_message_info). * Program output destined for stdout should use g_message. @@ -570,8 +572,6 @@ int main(int argc, char **argv) msgData.statusBar = NULL; g_log_set_default_handler(defaultMessageHandler, &msgData); - g_log_set_handler(NULL, (GLogLevelFlags)(G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION), - popupMessageHandler, &msgData); /* Initialise up the context with default values */ @@ -585,8 +585,6 @@ int main(int argc, char **argv) setTreeScaleCorr(bc, bc->treeMethod); - char *OrganismLabel = g_strdup("OS"); - gboolean verbose = FALSE; gboolean init_rmPartial = FALSE; @@ -635,7 +633,7 @@ int main(int argc, char **argv) case 'L': markupColorCodesFile = g_strdup(optarg); break; case 'm': readMatchFile = g_strdup(optarg); break; case 'n': makeNRinit = atof(optarg); break; - case 'O': strncpy(OrganismLabel, optarg, 2); break; + case 'O': strncpy(bc->organismLabel, optarg, 2); break; case 'o': output_format = g_strdup(optarg); break; case 'P': init_rmPartial = TRUE; break; case 'Q': init_rmGappyColumns = atof(optarg); break; @@ -965,6 +963,10 @@ int main(int argc, char **argv) /* We've finished all of the command-line-only options so now initialise the GTK GUI */ gtk_init(&argc, &argv); + /* After gtk_init is called, we can start using the popup message handler */ + g_log_set_handler(NULL, (GLogLevelFlags)(G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION), + popupMessageHandler, &msgData); + /* Update bits of the context that require the display to be initialised */ bc->removeSeqsCursor = gdk_cursor_new(GDK_PIRATE); bc->busyCursor = gdk_cursor_new(GDK_WATCH); @@ -1011,7 +1013,5 @@ int main(int argc, char **argv) gtk_main(); } - g_free(OrganismLabel) ; - return(EXIT_SUCCESS) ; }