/*! \brief Give the bounded area a new background tile number * * \param box - Which box to assign the value to */ void rename_bound_tile (s_bound *box) { int response, done; int selected_tile = 0; make_rect (double_buffer, 2, 32); sprintf (strbuf, "Tile: %d", box->btile); print_sfont (6, 6, strbuf, double_buffer); print_sfont (6, 12, ">", double_buffer); done = 0; while (!done) { blit2screen (); response = get_line (12, 12, strbuf, 4); /* If the user hits ESC, break out of the function entirely */ if (response == 0) return; /* Make sure this line isn't blank */ if (strlen (strbuf) > 0) { selected_tile = atoi (strbuf); /* Make sure the value is valid */ if (selected_tile < 0 || selected_tile >= ICONSET_SIZE * max_sets) { sprintf (strbuf, "Invalid tile: %d", selected_tile); cmessage (strbuf); wait_enter (); } else { done = 1; } } } box->btile = selected_tile; } /* rename_bound_tile () */
/* static */ void Debug::ConsoleOutput(const uni_char* str) { // Send all debug output to the console. if (g_console && g_console->IsLogging()) { OpConsoleEngine::Message cmessage(OpConsoleEngine::Internal, OpConsoleEngine::Debugging); OpStatus::Ignore(cmessage.message.Set(str)); TRAPD(rc, g_console->PostMessageL(&cmessage)); OpStatus::Ignore(rc); } }
/*! \brief Give the marker a new name if the name hasn't been taken already * * \param found - Which marker to rename */ void rename_marker (s_marker *found) { int response, done; s_marker *m; make_rect (double_buffer, 2, 32); print_sfont (6, 6, found->name, double_buffer); print_sfont (6, 12, ">", double_buffer); done = 0; while (!done) { blit2screen (); response = get_line (12, 12, strbuf, 31); /* If the user hits ESC, break out of the function entirely */ if (response == 0) return; /* Make sure this line isn't blank */ if (strlen (strbuf) == 0) { cmessage ("Do you want to clear the name of this marker? (y/n)"); if (yninput ()) done = 1; } else { done = 1; } /* Make sure no other markers have the same name */ for (m = gmap.markers; m < gmap.markers + num_markers; ++m) { if (!strcmp (strbuf, m->name) && m != found) { cmessage ("Another marker has that name. Use another name."); yninput (); done = 0; break; } } } strcpy (found->name, strbuf); } /* rename_marker () */
/* static */ void ES_ImportedAPI::PostToConsole(const uni_char* message, FramesDocument* fd) { if (!g_console->IsLogging()) return; URL* url = NULL; const uni_char *url_name = UNI_L("Script of unknown origin"); if (fd != NULL) { url = &fd->GetURL(); url_name = url->GetAttribute(URL::KUniName_Username_Password_Hidden).CStr(); } OpConsoleEngine::Message cmessage(OpConsoleEngine::EcmaScript, OpConsoleEngine::Error); OP_STATUS rc1, rc2, rc3; rc1 = cmessage.message.Set(message); if (url) { if (0 == uni_strcmp(url_name, UNI_L("POSTED"))) { // Message from opera.postError() cmessage.url.Empty(); cmessage.severity = OpConsoleEngine::Information; rc2 = OpStatus::OK; } else rc2 = cmessage.url.Set(url_name); } else rc2 = cmessage.url.Set(url_name); if (fd && fd->GetWindow()) cmessage.window = fd->GetWindow()->Id(); if (fd && fd->GetESScheduler()) rc3 = cmessage.context.Set(fd->GetESScheduler()->GetThreadInfoString()); else rc3 = cmessage.context.Set("Unknown thread"); if (OpStatus::IsSuccess(rc1) && OpStatus::IsSuccess(rc2) && OpStatus::IsSuccess(rc3)) { TRAPD(rc, g_console->PostMessageL(&cmessage)); OpStatus::Ignore(rc); // FIXME:OOM } }
/* static */ OP_STATUS JS_Console::PostConsoleMessage(LogType type, DOM_Runtime *runtime, ES_Value* argv, int argc) { OpConsoleEngine::Severity severity; switch (type) { case LOG_LOG: case LOG_DEBUG: case LOG_INFO: case LOG_WARN: severity = OpConsoleEngine::Information; break; case LOG_ASSERT: if (argc > 0) { // Skip the first argument to console.assert. --argc; ++argv; } case LOG_ERROR: severity = OpConsoleEngine::Error; break; default: return OpStatus::ERR; // Unsupported. } OpConsoleEngine::Message cmessage(OpConsoleEngine::EcmaScript, severity); FramesDocument *frm_doc = runtime->GetFramesDocument(); cmessage.window = (frm_doc ? frm_doc->GetWindow()->Id() : 0); RETURN_IF_ERROR(runtime->GetDisplayURL(cmessage.url)); RETURN_IF_ERROR(cmessage.context.Set(GetMessageContext(type))); RETURN_IF_ERROR(JS_Console::FormatString(argv, argc, cmessage.message)); RETURN_IF_LEAVE(g_console->PostMessageL(&cmessage)); return OpStatus::OK; }