예제 #1
0
      void VectorBaseView<std::complex<double> >::update_solution()
      {
        std::complex<double> * coeffs = new std::complex<double>[ndof + 1];
        memset(coeffs, 0, sizeof(std::complex<double> ) * (ndof + 1));
        if(base_index >= -1 && base_index < ndof)
          coeffs[base_index + 1] = 1.0;
        Solution<std::complex<double> >::vector_to_solution(coeffs, space, sln, pss);

        Hermes::Hermes2D::RealFilter filter(sln);

        this->VectorView::show(&filter, &filter, 0.001, H2D_FN_VAL_0, H2D_FN_VAL_1);
        update_title();

        delete [] coeffs;
      }
예제 #2
0
파일: nsevents.c 프로젝트: RareHare/reactos
static nsresult NSAPI handle_load(nsIDOMEventListener *iface, nsIDOMEvent *event)
{
    nsEventListener *This = impl_from_nsIDOMEventListener(iface);
    HTMLDocumentNode *doc = This->This->doc;
    nsIDOMHTMLElement *nsbody = NULL;
    HTMLDocumentObj *doc_obj = NULL;

    TRACE("(%p)\n", doc);

    if(!doc || !doc->basedoc.window)
        return NS_ERROR_FAILURE;
    if(doc->basedoc.doc_obj && doc->basedoc.doc_obj->basedoc.doc_node == doc)
        doc_obj = doc->basedoc.doc_obj;

    connect_scripts(doc->window);

    if(doc_obj)
        handle_docobj_load(doc_obj);

    set_ready_state(doc->basedoc.window, READYSTATE_COMPLETE);

    if(doc_obj) {
        if(doc_obj->view_sink)
            IAdviseSink_OnViewChange(doc_obj->view_sink, DVASPECT_CONTENT, -1);

        set_statustext(doc_obj, IDS_STATUS_DONE, NULL);

        update_title(doc_obj);
    }

    if(doc_obj && doc_obj->usermode!=EDITMODE && doc_obj->doc_object_service
       && !(doc->basedoc.window->load_flags & BINDING_REFRESH))
        IDocObjectService_FireDocumentComplete(doc_obj->doc_object_service,
                &doc->basedoc.window->base.IHTMLWindow2_iface, 0);

    if(!doc->nsdoc) {
        ERR("NULL nsdoc\n");
        return NS_ERROR_FAILURE;
    }

    nsIDOMHTMLDocument_GetBody(doc->nsdoc, &nsbody);
    if(nsbody) {
        fire_event(doc, EVENTID_LOAD, TRUE, (nsIDOMNode*)nsbody, event, (IDispatch*)&doc->window->base.IDispatchEx_iface);
        nsIDOMHTMLElement_Release(nsbody);
    }

    return NS_OK;
}
예제 #3
0
파일: cardman.c 프로젝트: gpg/gpa
static void
gpa_card_manager_init (GTypeInstance *instance, void *class_ptr)
{
  GpaCardManager *cardman = GPA_CARD_MANAGER (instance);
  gpg_error_t err;
  char *fname;

  cardman->cardtype = G_TYPE_NONE;
  cardman->cardtypename = "Unknown";
  update_title (cardman);

  construct_widgets (cardman);

  g_signal_connect (cardman, "destroy",
                    G_CALLBACK (card_manager_closed), cardman);


  /* We use the file watcher to speed up card change detection.  If it
     does not work (i.e. on non Linux based systems) the ticker takes
     care of it.  */
  fname = g_build_filename (gnupg_homedir, "reader_0.status", NULL);
  cardman->watch = gpa_add_filewatch (fname, "w", watcher_cb, cardman);
  xfree (fname);

  err = gpgme_new (&cardman->gpgagent);
  if (err)
    gpa_gpgme_error (err);

  err = gpgme_set_protocol (cardman->gpgagent, GPGME_PROTOCOL_ASSUAN);
  if (err)
    {
      if (gpg_err_code (err) == GPG_ERR_INV_VALUE)
        gpa_window_error (_("The GPGME library is too old to "
                            "support smartcards."), NULL);
      else
        gpa_gpgme_warning (err);
      gpgme_release (cardman->gpgagent);
      cardman->gpgagent = NULL;
    }

  setup_app_selector (cardman);
  if (cardman->app_selector)
    g_signal_connect (cardman->app_selector, "changed",
                      G_CALLBACK (app_selector_changed_cb), cardman);


}
예제 #4
0
void BaseView::update_solution()
{
  scalar* vec = new scalar[ndofs];
  memset(vec, 0, sizeof(scalar) * ndofs);
  if (base_index >= 0)
  {
    if (base_index < ndofs) vec[base_index] = 1.0;
    sln->set_fe_solution(space, pss, vec, 0.0);
  }
  else
  {
    sln->set_fe_solution(space, pss, vec, 1.0);
  }

  ScalarView::show(sln, eps, item);
  update_title();
}
예제 #5
0
void BaseView::update_solution()
{
  Vector* vec = new AVector(ndof);
  memset(vec->get_c_array(), 0, sizeof(scalar) * ndof);
  if (base_index >= 0)
  {
    if (base_index < ndof) vec->set(base_index, 1.0);
    sln->set_coeff_vector(space, pss, vec, 0.0);
  }
  else
  {
    sln->set_coeff_vector(space, pss, vec, 1.0);
  }

  ScalarView::show(sln, eps, item);
  update_title();
  delete vec;
}
예제 #6
0
void ModelMenu::_call (int N)
{
    if (0 <= N and N < m_size) {
        //open waiting dialog
        Menu* dialog = new Menu("building model...", Helv18, 0.5, 0.5, false);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        finish_buffer();

        //build model
        int edges = m_edges ? m_edges[N] : 1111;
        int faces = m_faces ? m_faces[N] : 111111;
        int weights = m_weights ? m_weights[N] : 1111;
        Polytope::select(m_nums[N], edges, faces, weights);
        update_title();

        //close dialog
        dialog->close();
    }
}
예제 #7
0
파일: base_view.cpp 프로젝트: karban/hermes
      void BaseView<double>::update_solution()
      {
        double* coeffs = new double[ndof];
        memset(coeffs, 0, sizeof(double) * ndof);
        if(base_index >= 0)
        {
          if(base_index < ndof) coeffs[base_index] = 1.0;
          Solution<double>::vector_to_solution(coeffs, space, sln, pss, false);
        }
        else
        {
          Solution<double>::vector_to_solution(coeffs, space, sln, pss, true);
        }

        ScalarView::show(sln, eps, item);
        update_title();

        delete [] coeffs;
      }
예제 #8
0
파일: nsevents.c 프로젝트: r6144/wine
static nsresult NSAPI handle_load(nsIDOMEventListener *iface, nsIDOMEvent *event)
{
    HTMLDocumentNode *doc = NSEVENTLIST_THIS(iface)->This->doc;
    nsIDOMHTMLElement *nsbody = NULL;
    HTMLDocumentObj *doc_obj = NULL;

    TRACE("(%p)\n", doc);

    if(!doc || !doc->basedoc.window)
        return NS_ERROR_FAILURE;
    if(doc->basedoc.doc_obj && doc->basedoc.doc_obj->basedoc.doc_node == doc)
        doc_obj = doc->basedoc.doc_obj;

    connect_scripts(doc->basedoc.window);

    if(doc_obj)
        handle_docobj_load(doc_obj);

    set_ready_state(doc->basedoc.window, READYSTATE_COMPLETE);

    if(doc_obj) {
        if(doc_obj->view_sink)
            IAdviseSink_OnViewChange(doc_obj->view_sink, DVASPECT_CONTENT, -1);

        set_statustext(doc_obj, IDS_STATUS_DONE, NULL);

        update_title(doc_obj);
    }

    if(!doc->nsdoc) {
        ERR("NULL nsdoc\n");
        return NS_ERROR_FAILURE;
    }

    nsIDOMHTMLDocument_GetBody(doc->nsdoc, &nsbody);
    if(nsbody) {
        fire_event(doc, EVENTID_LOAD, TRUE, (nsIDOMNode*)nsbody, event);
        nsIDOMHTMLElement_Release(nsbody);
    }

    return NS_OK;
}
예제 #9
0
파일: imp_drillbit.cpp 프로젝트: hk0i/lyngo
/**
 * @brief
 *  Sets up the ui for the next question by loading the question and answers.
 */
void DrillbitWin::next_question(void)
{
    QStringList answers;
    QString     tmpAnswer;
    int         i = 0;      // loop counter

    //enable widgets
    this->enable_all_buttons();

    // check if we hit the end of the quiz
    if (_quiz.currentQuestion() >= _quiz.count())
        return;

    // next Question & Answer pair for quiz.
    LyQuestion q = _quiz.next();

    do {
        tmpAnswer = _quiz.randomAnswer(q.isSwapped());
        if (!answers.contains(tmpAnswer)
                && tmpAnswer != q.answer()) {
            answers << tmpAnswer;
            i++;
        }
    } while(i < 3);

    // insert correct answer in randomly
    QTime now = QTime::currentTime();
    qsrand(now.msec());
    _current_answer = qrand() % 4;
    answers.insert(_current_answer, q.answer());
    _current_answer++;

    qDebug() << "Question & Answer:";
    qDebug() << q.question() << q.answer();
    qDebug() << "Choices:";
    qDebug() << answers;
    qDebug() << "Correct answer:" << _current_answer;

    lblWord->setText(q.question());
    this->answers_to_buttons(answers);
    update_title(true);
}
예제 #10
0
int
cdrom_open() {
	int	n;
	extern void update_title();

	if (cdrom_fd != -1)
		return(cdi.curtrack);

	if (app_data.device != NULL) {
		if ((cdrom_fd = open(app_data.device, O_RDONLY)) == -1) {
			perror(app_data.device);
			return(-1);
		}
	} else {
		if (   (cdrom_fd = open(cdrom, O_RDONLY)) == -1
		    && (cdrom_fd = open(cdrom1, O_RDONLY)) == -1
		   ) {
			perror("open: ");
			return(-1);
		}
	}

	if (cdrom_get_times() == -1) {
		cdrom_close();
		return(-1);
	}

	if ((n = cdrom_get_curtrack()) == -1)
		return(-1);

	get_stored_info();

	update_title();

	if (cdi.state & CDROM_STATE_PLAY)
		cdi.curtrack = n;

	if (cdi.state & CDROM_STATE_SHUFFLE)
		shuffle_setup();

	return(cdi.curtrack);
}
예제 #11
0
int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
	_In_opt_ HINSTANCE hPrevInstance,
	_In_ LPTSTR    lpCmdLine,
	_In_ int       nCmdShow)
{
	MSG msg;

	UNREFERENCED_PARAMETER(hPrevInstance);
	UNREFERENCED_PARAMETER(lpCmdLine);

	// Initialize global strings
	LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
	LoadString(hInstance, IDC_EVOLVEWIN, szWindowClass, MAX_LOADSTRING);
	MyRegisterClass(hInstance);

	// Perform application initialization:
	if (!InitInstance(hInstance, nCmdShow))
	{
		return FALSE;
	}

	hAccelTable = LoadAccelerators(hInst, MAKEINTRESOURCE(IDC_EVOLVEWIN));

	while (!g_Quit)
	{
		update_evolve();

		update_title();

		if (PeekMessage(&msg, g_hWnd, 0, 0, 1))
		{
			if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
			{
				TranslateMessage(&msg);
				DispatchMessage(&msg);
			}
		}
	}

	return (int)0;
}
예제 #12
0
      void BaseView<std::complex<double> >::update_solution()
      {
        std::complex<double>* coeffs = new std::complex<double>[ndof];
        memset(coeffs, 0, sizeof(std::complex<double>) * ndof);
        if(base_index >= 0)
        {
          if(base_index < ndof) coeffs[base_index] = 1.0;
          Solution<std::complex<double> >::vector_to_solution(coeffs, space, sln, pss, false);
        }
        else
        {
          Solution<std::complex<double> >::vector_to_solution(coeffs, space, sln, pss, true);
        }


        complex_filter = MeshFunctionSharedPtr<double>(new Hermes::Hermes2D::RealFilter(sln.get()));
        ScalarView::show(complex_filter, eps, item);
        update_title();

        delete [] coeffs;
      }
예제 #13
0
파일: imp_drillbit.cpp 프로젝트: hk0i/lyngo
/**
 * @brief
 *  Loads a dictionary into the quiz and begins the quiz
 */
void DrillbitWin::on_mnuFileOpenVocabulary_triggered(bool checked)
{
    // get file name
    QString filename;
    filename = QFileDialog::getOpenFileName(this,
            tr("Open drillbit dictionary..."),
            "",
            tr("Lyngo Drillbit Dictionaries (*.ldb)")
    );
    // load it into lyquiz
    if (!filename.isEmpty()) {
        LyDict tmpDict;
        tmpDict.load(filename);
        _quiz.loadDictionary(tmpDict);
        install_preferences();
        _mistakes = 0;
        update_title(true);
        next_question();
        update_statusbar();
    }
}
예제 #14
0
void update(Game_Data *data)
{
	switch(current_state)
	{
		case GAME:
		update_game(data);
		break;
		case TITLE:
		update_title(data);
		break;
		case MENU:
		update_menu(data);
		break;
		case GAME_OVER:
		update_game_over(data);
		break;
		case OUT_OF_MEMORY:
		update_oom(data);
		break;
	}
	key_latch_update(data);
}
예제 #15
0
void AudioPlayer::load(QVariantMap &d)
{
    QMap<QString, QVariant>::const_iterator i = d.constBegin();
    while (i != d.constEnd())
    {
        playerData[i.key()] = i.value();
        ++i;
    }

    update_status(Common::audioStatusFromString(playerData["status"].toString()));
    update_id(playerData["id"].toString());
    update_cover(playerData["cover_url"].toString());
    update_name(playerData["name"].toString());
    update_volume(playerData["volume"].toDouble());

    qDebug() << "New player loaded: " << get_name();

    QVariantMap currentTrack = playerData["current_track"].toMap();
    update_title(currentTrack["title"].toString());
    update_album(currentTrack["album"].toString());
    update_artist(currentTrack["artist"].toString());

    connect(connection, SIGNAL(eventAudioChange(QString)),
            this, SLOT(audioChanged(QString)));
    connect(connection, SIGNAL(eventAudioStateChange(QVariantMap)),
            this, SLOT(audioStateChanged(QVariantMap)));
    connect(connection, SIGNAL(eventAudioStatusChange(QString,QString)),
            this, SLOT(audioStatusChanged(QString,QString)));
    connect(connection, SIGNAL(eventAudioVolumeChange(QString,double)),
            this, SLOT(audioVolumeChanged(QString,double)));

    if (!loaded)
    {
        loaded = true;
        audioChanged(get_id());
    }
}
예제 #16
0
void Gobby::TitleBar::on_document_changed(SessionView* view)
{
	if(m_current_view != NULL)
	{
		InfSession* session = m_current_view->get_session();
		InfBuffer* buffer = inf_session_get_buffer(session);

		g_signal_handler_disconnect(G_OBJECT(session),
		                            m_notify_status_handler);
		g_signal_handler_disconnect(G_OBJECT(buffer),
		                            m_notify_modified_handler);
		
		m_rename_handler.disconnect();
	}

	m_current_view = view;

	if(view != NULL)
	{
		InfSession* session = view->get_session();
		InfBuffer* buffer = inf_session_get_buffer(session);

		m_notify_status_handler = g_signal_connect(
			G_OBJECT(session), "notify::status",
			G_CALLBACK(on_notify_status_static), this);
		m_notify_modified_handler = g_signal_connect(
			G_OBJECT(buffer), "notify::modified",
			G_CALLBACK(on_notify_modified_static), this);
		
		// We are subscribing to the view's signal to avoid a race condition,
		// since we can't otherwise guarantee that the view's new name has already been set
		m_rename_handler = m_current_view->signal_session_name_changed().connect(
			sigc::mem_fun(*this, &TitleBar::on_session_name_changed));
	}

	update_title();
}
예제 #17
0
파일: uzbl.c 프로젝트: dusanx/uzbl
static gboolean
key_press_cb (WebKitWebView* page, GdkEventKey* event)
{
    //TRUE to stop other handlers from being invoked for the event. FALSE to propagate the event further.

    (void) page;
    Action *action;

    if (event->type != GDK_KEY_PRESS || event->keyval == GDK_Page_Up || event->keyval == GDK_Page_Down
        || event->keyval == GDK_Up || event->keyval == GDK_Down || event->keyval == GDK_Left || event->keyval == GDK_Right)
        return FALSE;

    /* turn off insert mode (if always_insert_mode is not used) */
    if (insert_mode && (event->keyval == GDK_Escape)) {
        insert_mode = always_insert_mode;
        update_title();
        return TRUE;
    }

    if (insert_mode && ((event->state & modmask) != modmask))
        return FALSE;

    if (event->keyval == GDK_Escape) {
        g_string_truncate(keycmd, 0);
        update_title();
        return TRUE;
    }

    //Insert without shift - insert from clipboard; Insert with shift - insert from primary
    if (event->keyval == GDK_Insert) {
        gchar * str;
        if ((event->state & GDK_SHIFT_MASK) == GDK_SHIFT_MASK) {
            str = gtk_clipboard_wait_for_text (gtk_clipboard_get (GDK_SELECTION_PRIMARY));
        } else {
            str = gtk_clipboard_wait_for_text (gtk_clipboard_get (GDK_SELECTION_CLIPBOARD)); 
        }
        if (str) {
            g_string_append_printf (keycmd, "%s",  str);
            update_title ();
            free (str);
        }
        return TRUE;
    }

    if ((event->keyval == GDK_BackSpace) && (keycmd->len > 0)) {
        g_string_truncate(keycmd, keycmd->len - 1);
        update_title();
        return TRUE;
    }

    if ((event->keyval == GDK_Return) || (event->keyval == GDK_KP_Enter)) {
        GString* short_keys = g_string_new ("");
        unsigned int i;
        for (i=0; i<(keycmd->len); i++) {
            g_string_append_c(short_keys, keycmd->str[i]);
            g_string_append_c(short_keys, '_');
            
            //printf("\nTesting string: @%s@\n", short_keys->str);
            if ((action = g_hash_table_lookup(bindings, short_keys->str))) {
                GString* parampart = g_string_new (keycmd->str);
                g_string_erase (parampart, 0, i+1);
                //printf("\nParameter: @%s@\n", parampart->str);
                GString* actionname = g_string_new ("");
                if (action->name)
                    g_string_printf (actionname, action->name, parampart->str);
                GString* actionparam = g_string_new ("");
                if (action->param)
                    g_string_printf (actionparam, action->param, parampart->str);
                parse_command(actionname->str, actionparam->str);
                g_string_free (actionname, TRUE);
                g_string_free (actionparam, TRUE);
                g_string_free (parampart, TRUE);
                g_string_truncate(keycmd, 0);
                update_title();
            }          

            g_string_truncate(short_keys, short_keys->len - 1);
        }
        g_string_free (short_keys, TRUE);
        return (!insert_mode);
    }

    g_string_append(keycmd, event->string);
    if ((action = g_hash_table_lookup(bindings, keycmd->str))) {
        g_string_truncate(keycmd, 0);
        parse_command(action->name, action->param);
    }

    update_title();

    return TRUE;
}
예제 #18
0
파일: events.cpp 프로젝트: igrek51/SongBook
void App::event_init(HWND *window){
	main_window = *window;
    //parametry
	IO::geti()->get_args();
	//katalog roboczy
	set_workdir();
	//ustawienia
    Config::geti()->load_from_file();
    //jeœli aplikacja jest ju¿ uruchomiona
    if(IO::geti()->args.size()==2 && instancja2!=NULL){//jeden dodatkowy parametr - nazwa pliku do otwarcia
        IO::geti()->log("Wysy³anie pliku do otwartej instancji aplikacji...");
        for(unsigned int i=0; i<IO::geti()->args.at(1).length(); i++){
            SendMessage(instancja2, 0x0319, 69, (char)IO::geti()->args.at(1)[i]);
        }
        SendMessage(instancja2, 0x0319, 69, 0);
        IO::geti()->log("Zamykanie zbêdnej instancji aplikacji...");
        //SendMessage(main_window, WM_DESTROY, 0, 0);
        DestroyWindow(main_window);
        return;
    }
    //log
    if(Config::geti()->log_enabled){
        IO::geti()->clear_log();
    }
	//kontrolki
    IO::geti()->log("Tworzenie kontrolek...");
    Controls::geti()->create_static_center("Plik:", 0, 0, 0, 0, "filename");
    Controls::geti()->create_edit("", 0, 0, 0, 0, "filename_edit");

    Controls::geti()->create_edit_center(Config::i()->find_edit_placeholder, 0, 0, 0, 0, "find_edit");
    Controls::geti()->create_edit_center(Config::i()->replace_edit_placeholder, 0, 0, 0, 0, "replace_edit");
    Controls::geti()->create_edit_center("", 0, 0, 0, 0, "autoscroll_interval");
    Controls::geti()->create_edit_center("", 0, 0, 0, 0, "autoscroll_wait");
    Controls::geti()->create_button("Autoscroll: off", 0, 0, 0, 0, "autoscroll");
    Controls::geti()->create_button("Analizuj", 0, 0, 0, 0, "analyze");

    for(int i=0; i<Config::geti()->cmd_outputs_num; i++){
        stringstream ss;
        ss<<"cmd_output"<<i+1;
        Controls::geti()->create_static_center("", 0, 0, 0, 0, ss.str());
    }
    Controls::geti()->create_edit("", 0, 0, 0, 0, "cmd");
	//edytor
    IO::geti()->log("Tworzenie edytora tekstu...");
	if(LoadLibrary("RICHED32.DLL")==NULL){
		IO::geti()->critical_error("B³¹d: brak biblioteki RICHED32.DLL");
		return;
	}
    HWND editor_handle = CreateWindowEx(WS_EX_CLIENTEDGE, RICHEDIT_CLASS, "", WS_CHILD|WS_VISIBLE|WS_VSCROLL|ES_MULTILINE|ES_DISABLENOSCROLL, 0, 0, 0, 0, main_window, (HMENU)100, *hInst, 0);
    Controls::geti()->controls.push_back(new Control(editor_handle, "editor"));
    //tworzenie menu
    IO::geti()->log("Tworzenie menu...");
    Menu* menu_plik = new Menu();
    menu_plik->add_option("Nowy [Ctrl + N]", "new");
    menu_plik->add_separator();
    menu_plik->add_option("Otwórz", "load");
    menu_plik->add_option("Prze³aduj", "reload");
    menu_plik->add_option("Zapisz [Ctrl + S]", "save");
    menu_plik->add_separator();
    menu_plik->add_option("Baza akordów [Ctrl + B]", "base");
    menu_plik->add_separator();
    menu_plik->add_option("Zakoñcz", "exit");
    Menu* menu_edycja = new Menu();
    menu_edycja->add_option("Analizuj i napraw", "analyze");
    menu_edycja->add_separator();
    menu_edycja->add_option("Cofnij [Ctrl + Z]", "undo");
    menu_edycja->add_option("Szukaj [Ctrl + F]", "find");
    menu_edycja->add_option("Zamieñ", "replace");
    menu_edycja->add_option("Szybka zamiana tekstu [Ctrl + T]", "quick_replace");
    menu_edycja->add_separator();
    menu_edycja->add_option("Utwórz akord z zaznaczenia [Ctrl + D]", "add_chord");
    menu_edycja->add_option("Usuñ akordy [Ctrl + Q]", "remove_chords");
    menu_edycja->add_option("Usuñ alternatywne wersje akordów", "remove_alt");
    menu_edycja->add_separator();
    menu_edycja->add_option("Zapisz schemat akordów [Ctrl + W]", "save_pattern");
    menu_edycja->add_option("Wstaw schemat akordów [Ctrl + E]", "insert_pattern");
    Menu* menu_widok = new Menu();
    menu_widok->add_option("Zwiêksz czcionkê [Ctrl +]", "font++");
    menu_widok->add_option("Zmniejsz czcionkê [Ctrl -]", "font--");
    menu_widok->add_separator();
    menu_widok->add_option("Formatuj tekst [Ctrl + R]", "format_text");
    menu_widok->add_option("Przewiñ na pocz¹tek [F1]", "scroll_to_begin");
    menu_widok->add_option("Przewiñ na koniec", "scroll_to_end");
    menu_widok->add_separator();
    menu_widok->add_option("Pe³ny ekran [F10, F11]", "fullscreen");
    Menu* menu_autoscroll = new Menu();
    menu_autoscroll->add_option("W³¹cz z opóŸnieniem [F7]", "autoscroll_wait");
    menu_autoscroll->add_option("W³¹cz bez opóŸnienia [F8]", "autoscroll_nowait");
    menu_autoscroll->add_option("Wy³¹cz", "autoscroll_off");
    menu_autoscroll->add_separator();
    menu_autoscroll->add_option("Zwolnij przewijanie [F5]", "autoscroll_slower");
    menu_autoscroll->add_option("Przyspiesz przewijanie [F6]", "autoscroll_faster");
    Menu* menu_transpozycja = new Menu();
    menu_transpozycja->add_option("Transponuj 5 pó³tonów w górê", "transpose+5");
    menu_transpozycja->add_option("Transponuj 1 pó³ton w górê [Ctrl + prawo]", "transpose++");
    menu_transpozycja->add_separator();
    menu_transpozycja->add_option("Transponuj 1 pó³ton w dó³ [Ctrl + lewo]", "transpose--");
    menu_transpozycja->add_option("Transponuj 5 pó³tonów w dó³", "transpose-5");
    menu_transpozycja->add_separator();
    menu_transpozycja->add_option("Oryginalna tonacja [Ctrl + 0]", "transpose0");
    menu_transpozycja->add_separator();
    menu_transpozycja->add_option("Dodaj alternatywn¹ tonacjê", "alt");
    Menu* menu_ustawienia = new Menu();
    menu_ustawienia->add_option("Plik konfiguracyjny", "config");
    menu_ustawienia->add_option("Wiersz poleceñ [Ctrl + `]", "cmd_toggle");
    menu_ustawienia->add_option("Dziennik zdarzeñ", "log");
    menu_ustawienia->add_option("Skojarz pliki .crd z programem", "associate_files");
    Menu* menu_pomoc = new Menu();
    menu_pomoc->add_option("Polecenia i skróty klawiszowe", "help");
    menu_pomoc->add_option("O programie", "info");
    //g³ówny pasek menu
    Menu* menu_bar = new Menu();
    menu_bar->add_menu(menu_plik, "Plik");
    menu_bar->add_menu(menu_edycja, "Edycja");
    menu_bar->add_menu(menu_widok, "Widok");
    menu_bar->add_option("Pasek narzêdzi", "toolbar_toggle");
    menu_bar->add_menu(menu_autoscroll, "Autoscroll");
    menu_bar->add_menu(menu_transpozycja, "Transpozycja");
    menu_bar->add_menu(menu_ustawienia, "Ustawienia");
    menu_bar->add_menu(menu_pomoc, "Pomoc");
    SetMenu(main_window, menu_bar->handle);
    //autoscroll edits
    IO::geti()->log("Wype³nianie kontrolek, zmiana czcionek...");
    Controls::geti()->set_text("autoscroll_interval", Config::geti()->autoscroll_interval);
    Controls::geti()->set_text("autoscroll_wait", Config::geti()->autoscroll_wait);
    //czcionki
    controls_fonts_set();
	Controls::geti()->set_focus("editor");
	//subclassing
    IO::geti()->log("Subclassing...");
    for(unsigned int i=0; i<Controls::geti()->controls.size(); i++){
        subclass(Controls::geti()->controls.at(i));
    }
	//pasek schowany przy starcie
	if(!Config::geti()->toolbar_show){
		toolbar_switch(0);
	}
    //baza akordów na start (jeœli nie by³ otwierany wybrany plik)
    if(Config::geti()->chordsbase_on_startup && IO::geti()->args.size()<=1){
        chordsbase_start();
        SetForegroundWindow(main_window);
    }
	//okno na po³owie ekranu
	if(Config::geti()->halfscreen==1){
        IO::geti()->log("Rozmieszczanie okna na po³owie ekranu...");
        RECT workArea;
        SystemParametersInfo(SPI_GETWORKAREA, 0, &workArea, 0);
        int offset_x = - GetSystemMetrics(SM_CXSIZEFRAME);
        int w = (workArea.right - workArea.left) / 2 - offset_x*2;
        int h = workArea.bottom - workArea.top + GetSystemMetrics(SM_CYSIZEFRAME);
		SetWindowPos(main_window, HWND_TOP, workArea.left + offset_x, workArea.top, w, h, 0);
    }
    event_resize();
    //drag & drop
    IO::geti()->log("Uaktywanianie funkcji drag & drop...");
	DragAcceptFiles(main_window, true);
	Controls::geti()->set_text("editor", "");
	//wczytanie pliku zadanego parametrem
	if(IO::geti()->args.size()==2){ //jeden dodatkowy parametr - nazwa pliku do otwarcia
		open_chords_file(IO::geti()->args.at(1));
	}
	update_title();
    refresh_text();
	IO::geti()->echo("Gotów do pracy - wersja "+version);
}
예제 #19
0
int RecordGUI::update_prev_label(long new_position) 
{ 
	update_title(prev_label_title, new_position);
}
예제 #20
0
파일: print-editor.c 프로젝트: Aridna/gtk2
static void
update_ui (void)
{
  update_title ();
  update_statusbar ();
}
예제 #21
0
static void
notify_progress_cb (WebKitWebView* web_view, GParamSpec* pspec, gpointer data)
{
    load_progress = webkit_web_view_get_progress (web_view) * 100;
    update_title (GTK_WINDOW (main_window));
}
예제 #22
0
파일: titlebar.cpp 프로젝트: Kaligule/gobby
void Gobby::TitleBar::on_notify_status()
{
	update_title();
}
예제 #23
0
WAttGtk::WAttGtk(GtkWidget* wa_parent_wid, void* wa_parent_ctx,
    ldh_tSesContext wa_ldhses, pwr_sAttrRef wa_aref, int wa_editmode,
    int wa_advanced_user, int wa_display_objectname)
    : WAtt(wa_parent_ctx, wa_ldhses, wa_aref, wa_editmode, wa_advanced_user,
          wa_display_objectname),
      parent_wid(wa_parent_wid)
{
  int sts;
  int size;
  char* namep;

  sts = ldh_AttrRefToName(ldhses, &aref, ldh_eName_Hierarchy, &namep, &size);
  if (EVEN(sts))
    return;

  toplevel = (GtkWidget*)g_object_new(GTK_TYPE_WINDOW, "default-height", 570,
      "default-width", 410, "title", CoWowGtk::convert_utf8(namep), NULL);

  g_signal_connect(toplevel, "delete_event", G_CALLBACK(delete_event), this);
  g_signal_connect(toplevel, "destroy", G_CALLBACK(destroy_event), this);
  g_signal_connect(
      toplevel, "focus-in-event", G_CALLBACK(action_inputfocus), this);

  CoWowGtk::SetWindowIcon(toplevel);

  GtkWidget* vbox = gtk_vbox_new(FALSE, 0);

  // Menu
  // Accelerators
  GtkAccelGroup* accel_g
      = (GtkAccelGroup*)g_object_new(GTK_TYPE_ACCEL_GROUP, NULL);
  gtk_window_add_accel_group(GTK_WINDOW(toplevel), accel_g);

  GtkMenuBar* menu_bar = (GtkMenuBar*)g_object_new(GTK_TYPE_MENU_BAR, NULL);

  // File entry
  GtkWidget* file_close
      = gtk_image_menu_item_new_from_stock(GTK_STOCK_CLOSE, accel_g);
  g_signal_connect(file_close, "activate", G_CALLBACK(activate_exit), this);

  GtkWidget* file_print
      = gtk_image_menu_item_new_from_stock(GTK_STOCK_PRINT, accel_g);
  g_signal_connect(file_print, "activate", G_CALLBACK(activate_print), this);

  GtkMenu* file_menu = (GtkMenu*)g_object_new(GTK_TYPE_MENU, NULL);
  gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_print);
  gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_close);

  GtkWidget* file = gtk_menu_item_new_with_mnemonic("_File");
  gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), file);
  gtk_menu_item_set_submenu(GTK_MENU_ITEM(file), GTK_WIDGET(file_menu));

  // Functions entry
  GtkWidget* func_changevalue
      = gtk_menu_item_new_with_mnemonic("_Change Value");
  g_signal_connect(
      func_changevalue, "activate", G_CALLBACK(activate_change_value), this);
  gtk_widget_add_accelerator(func_changevalue, "activate", accel_g, 'q',
      GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);

  GtkWidget* func_close_changeval
      = gtk_menu_item_new_with_mnemonic("C_lose Change Value");
  g_signal_connect(func_close_changeval, "activate",
      G_CALLBACK(activate_close_changeval), this);
  gtk_widget_add_accelerator(func_close_changeval, "activate", accel_g, 't',
      GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);

  GtkMenu* func_menu = (GtkMenu*)g_object_new(GTK_TYPE_MENU, NULL);
  gtk_menu_shell_append(GTK_MENU_SHELL(func_menu), func_changevalue);
  gtk_menu_shell_append(GTK_MENU_SHELL(func_menu), func_close_changeval);

  GtkWidget* functions = gtk_menu_item_new_with_mnemonic("_Functions");
  gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), functions);
  gtk_menu_item_set_submenu(GTK_MENU_ITEM(functions), GTK_WIDGET(func_menu));

  // Help entry
  GtkWidget* help_help
      = gtk_image_menu_item_new_from_stock(GTK_STOCK_HELP, accel_g);
  g_signal_connect(help_help, "activate", G_CALLBACK(activate_help), this);

  GtkMenu* help_menu = (GtkMenu*)g_object_new(GTK_TYPE_MENU, NULL);
  gtk_menu_shell_append(GTK_MENU_SHELL(help_menu), help_help);

  GtkWidget* help = gtk_menu_item_new_with_mnemonic("_Help");
  gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), help);
  gtk_menu_item_set_submenu(GTK_MENU_ITEM(help), GTK_WIDGET(help_menu));

  pane = gtk_vpaned_new();

  if (((WUtility*)parent_ctx)->utype == wb_eUtility_WNav)
    parent_ctx = ((WNav*)parent_ctx)->parent_ctx;
  utility = ((WUtility*)parent_ctx)->utype;

  wattnav = new WAttNavGtk((void*)this, wattnav_eType_Object, pane, "Plant",
      ldhses, aref, wa_editmode, wa_advanced_user, wa_display_objectname,
      utility, &brow_widget, &sts);
  ((WAttNav*)wattnav)->message_cb = &WAtt::message_cb;
  ((WAttNav*)wattnav)->change_value_cb = &WAtt::change_value_cb;

  GtkWidget* statusbar = gtk_hbox_new(FALSE, 0);
  msg_label = gtk_label_new("");
  gtk_widget_set_size_request(msg_label, -1, 25);
  cmd_prompt = gtk_label_new("value > ");
  gtk_widget_set_size_request(cmd_prompt, -1, 25);
  cmd_entry = new CoWowEntryGtk(&value_recall);
  cmd_entry->set_hide_on_esc(true);
  cmd_input = cmd_entry->widget();
  gtk_widget_set_size_request(cmd_input, -1, 25);
  g_signal_connect(cmd_input, "activate", G_CALLBACK(activate_cmd_input), this);
  g_signal_connect(cmd_input, "hide", G_CALLBACK(hide_cmd_input), this);

  gtk_box_pack_start(GTK_BOX(statusbar), msg_label, FALSE, FALSE, 0);
  gtk_box_pack_start(GTK_BOX(statusbar), cmd_prompt, FALSE, FALSE, 0);
  gtk_box_pack_start(GTK_BOX(statusbar), cmd_input, TRUE, TRUE, 0);

  gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(menu_bar), FALSE, FALSE, 0);
  gtk_box_pack_end(GTK_BOX(vbox), GTK_WIDGET(pane), TRUE, TRUE, 0);

  gtk_paned_pack1(GTK_PANED(pane), GTK_WIDGET(brow_widget), TRUE, TRUE);
  gtk_paned_pack2(GTK_PANED(pane), GTK_WIDGET(statusbar), FALSE, TRUE);

  gtk_container_add(GTK_CONTAINER(toplevel), vbox);

  cmd_scrolled_buffer = gtk_text_buffer_new(NULL);
  g_signal_connect_after(cmd_scrolled_buffer, "insert-text",
      G_CALLBACK(action_text_inserted), this);

  cmd_scrolledtextview = gtk_text_view_new_with_buffer(cmd_scrolled_buffer);
  GtkWidget* viewport = gtk_viewport_new(NULL, NULL);
  GtkWidget* scrolledwindow = gtk_scrolled_window_new(NULL, NULL);
  gtk_container_add(GTK_CONTAINER(viewport), cmd_scrolledtextview);
  gtk_container_add(GTK_CONTAINER(scrolledwindow), viewport);

  cmd_scrolled_ok = gtk_button_new_with_label("Ok");
  gtk_widget_set_size_request(cmd_scrolled_ok, 70, 25);
  g_signal_connect(
      cmd_scrolled_ok, "clicked", G_CALLBACK(activate_cmd_scrolled_ok), this);
  cmd_scrolled_ca = gtk_button_new_with_label("Cancel");
  gtk_widget_set_size_request(cmd_scrolled_ca, 70, 25);
  g_signal_connect(
      cmd_scrolled_ca, "clicked", G_CALLBACK(activate_cmd_scrolled_ca), this);

  GtkWidget* hboxbuttons = gtk_hbox_new(TRUE, 40);
  gtk_box_pack_start(GTK_BOX(hboxbuttons), cmd_scrolled_ok, FALSE, FALSE, 0);
  gtk_box_pack_end(GTK_BOX(hboxbuttons), cmd_scrolled_ca, FALSE, FALSE, 0);

  cmd_scrolledinput = gtk_vbox_new(FALSE, 0);
  gtk_box_pack_start(GTK_BOX(cmd_scrolledinput), scrolledwindow, TRUE, TRUE, 0);
  gtk_box_pack_start(GTK_BOX(cmd_scrolledinput), hboxbuttons, FALSE, FALSE, 5);

  gtk_box_pack_start(GTK_BOX(statusbar), cmd_scrolledinput, TRUE, TRUE, 0);

  gtk_widget_show_all(toplevel);

  g_object_set(cmd_prompt, "visible", FALSE, NULL);
  g_object_set(cmd_input, "visible", FALSE, NULL);
  g_object_set(cmd_scrolledinput, "visible", FALSE, NULL);

  int w, h;
  gdk_drawable_get_size(pane->window, &w, &h);
  gtk_paned_set_position(GTK_PANED(pane), h - 50);

  if (utility == wb_eUtility_Wtt) {
    ((Wtt*)parent_ctx)
        ->register_utility((void*)this, wb_eUtility_AttributeEditor);
  }

  update_title();
}
예제 #24
0
파일: print-editor.c 프로젝트: GYGit/gtk
static void
activate (GApplication *app)
{
  GtkWidget *box;
  GtkWidget *bar;
  GtkWidget *sw;
  GtkWidget *contents;

  main_window = gtk_application_window_new (GTK_APPLICATION (app));
  gtk_window_set_icon_name (GTK_WINDOW (main_window), "text-editor");
  gtk_window_set_default_size (GTK_WINDOW (main_window), 400, 600);
  update_title (GTK_WINDOW (main_window));

  box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
  gtk_container_add (GTK_CONTAINER (main_window), box);

  bar = gtk_menu_bar_new ();
  gtk_widget_show (bar);
  gtk_container_add (GTK_CONTAINER (box), bar);

  /* Create document  */
  sw = gtk_scrolled_window_new (NULL, NULL);

  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
                                  GTK_POLICY_AUTOMATIC,
                                  GTK_POLICY_AUTOMATIC);

  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
                                       GTK_SHADOW_IN);

  gtk_widget_set_vexpand (sw, TRUE);
  gtk_container_add (GTK_CONTAINER (box), sw);

  contents = gtk_text_view_new ();
  gtk_widget_grab_focus (contents);

  gtk_container_add (GTK_CONTAINER (sw),
                     contents);

  /* Create statusbar */
  statusbar = gtk_statusbar_new ();
  gtk_container_add (GTK_CONTAINER (box), statusbar);

  /* Show text widget info in the statusbar */
  buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (contents));

  g_signal_connect_object (buffer,
                           "changed",
                           G_CALLBACK (buffer_changed_callback),
                           NULL,
                           0);

  g_signal_connect_object (buffer,
                           "mark_set", /* cursor moved */
                           G_CALLBACK (mark_set_callback),
                           NULL,
                           0);

  update_ui ();

  gtk_widget_show_all (main_window);
}
예제 #25
0
파일: gl-main.c 프로젝트: GKerison/mupdf-1
int main(int argc, char **argv)
#endif
{
	const GLFWvidmode *video_mode;
	char filename[2048];
	char *password = "";
	float layout_w = DEFAULT_LAYOUT_W;
	float layout_h = DEFAULT_LAYOUT_H;
	float layout_em = DEFAULT_LAYOUT_EM;
	char *layout_css = NULL;
	int c;

	while ((c = fz_getopt(argc, argv, "p:r:W:H:S:U:")) != -1)
	{
		switch (c)
		{
		default: usage(argv[0]); break;
		case 'p': password = fz_optarg; break;
		case 'r': currentzoom = fz_atof(fz_optarg); break;
		case 'W': layout_w = fz_atof(fz_optarg); break;
		case 'H': layout_h = fz_atof(fz_optarg); break;
		case 'S': layout_em = fz_atof(fz_optarg); break;
		case 'U': layout_css = fz_optarg; break;
		}
	}

	if (fz_optind < argc)
	{
		fz_strlcpy(filename, argv[fz_optind], sizeof filename);
	}
	else
	{
#ifdef _WIN32
		win_install();
		if (!win_open_file(filename, sizeof filename))
			exit(0);
#else
		usage(argv[0]);
#endif
	}

	title = strrchr(filename, '/');
	if (!title)
		title = strrchr(filename, '\\');
	if (title)
		++title;
	else
		title = filename;

	memset(&ui, 0, sizeof ui);

	search_input.p = search_input.text;
	search_input.q = search_input.p;
	search_input.end = search_input.p;

	if (!glfwInit()) {
		fprintf(stderr, "cannot initialize glfw\n");
		exit(1);
	}

	video_mode = glfwGetVideoMode(glfwGetPrimaryMonitor());
	screen_w = video_mode->width;
	screen_h = video_mode->height;

	glfwSetErrorCallback(on_error);

	window = glfwCreateWindow(DEFAULT_WINDOW_W, DEFAULT_WINDOW_H, filename, NULL, NULL);
	if (!window) {
		fprintf(stderr, "cannot create glfw window\n");
		exit(1);
	}

	glfwMakeContextCurrent(window);

	ctx = fz_new_context(NULL, NULL, 0);
	fz_register_document_handlers(ctx);

	if (layout_css)
	{
		fz_buffer *buf = fz_read_file(ctx, layout_css);
		fz_write_buffer_byte(ctx, buf, 0);
		fz_set_user_css(ctx, (char*)buf->data);
		fz_drop_buffer(ctx, buf);
	}

	has_ARB_texture_non_power_of_two = glfwExtensionSupported("GL_ARB_texture_non_power_of_two");
	if (!has_ARB_texture_non_power_of_two)
		fz_warn(ctx, "OpenGL implementation does not support non-power of two texture sizes");

	glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size);

	ui.fontsize = DEFAULT_UI_FONTSIZE;
	ui.baseline = DEFAULT_UI_BASELINE;
	ui.lineheight = DEFAULT_UI_LINEHEIGHT;

	ui_init_fonts(ctx, ui.fontsize);

	doc = fz_open_document(ctx, filename);
	if (fz_needs_password(ctx, doc))
	{
		if (!fz_authenticate_password(ctx, doc, password))
		{
			fprintf(stderr, "Invalid password.\n");
			exit(1);
		}
	}

	outline = fz_load_outline(ctx, doc);
	pdf = pdf_specifics(ctx, doc);
	if (pdf)
		pdf_enable_js(ctx, pdf);

	fz_layout_document(ctx, doc, layout_w, layout_h, layout_em);

	render_page();
	update_title();
	shrinkwrap();

	glfwSetFramebufferSizeCallback(window, on_reshape);
	glfwSetCursorPosCallback(window, on_mouse_motion);
	glfwSetMouseButtonCallback(window, on_mouse_button);
	glfwSetScrollCallback(window, on_scroll);
	glfwSetCharModsCallback(window, on_char);
	glfwSetKeyCallback(window, on_key);
	glfwSetWindowRefreshCallback(window, on_display);

	glfwGetFramebufferSize(window, &window_w, &window_h);

	ui_needs_update = 1;

	while (!glfwWindowShouldClose(window))
	{
		glfwWaitEvents();
		if (ui_needs_update)
			run_main_loop();
	}

	ui_finish_fonts(ctx);

	fz_drop_link(ctx, links);
	fz_drop_page(ctx, page);
	fz_drop_outline(ctx, outline);
	fz_drop_document(ctx, doc);
	fz_drop_context(ctx);

	glfwTerminate();

	return 0;
}
예제 #26
0
void Gobby::TitleBar::on_session_name_changed(const Glib::ustring& new_name)
{
	update_title();
}
예제 #27
0
파일: titlebar.cpp 프로젝트: Kaligule/gobby
void Gobby::TitleBar::on_notify_modified()
{
	update_title();
}
예제 #28
0
static void do_canvas(void)
{
    static int saved_scroll_x = 0;
    static int saved_scroll_y = 0;
    static int saved_ui_x = 0;
    static int saved_ui_y = 0;

    float x, y;

    if (oldpage != currentpage || oldzoom != currentzoom || oldrotate != currentrotate)
    {
        render_page();
        update_title();
        oldpage = currentpage;
        oldzoom = currentzoom;
        oldrotate = currentrotate;
    }

    if (ui.x >= canvas_x && ui.x < canvas_x + canvas_w && ui.y >= canvas_y && ui.y < canvas_y + canvas_h)
    {
        ui.hot = doc;
        if (!ui.active && ui.middle)
        {
            ui.active = doc;
            saved_scroll_x = scroll_x;
            saved_scroll_y = scroll_y;
            saved_ui_x = ui.x;
            saved_ui_y = ui.y;
        }
    }

    if (ui.hot == doc)
    {
        scroll_x -= ui.scroll_x * ui.lineheight * 3;
        scroll_y -= ui.scroll_y * ui.lineheight * 3;
    }

    if (ui.active == doc)
    {
        scroll_x = saved_scroll_x + saved_ui_x - ui.x;
        scroll_y = saved_scroll_y + saved_ui_y - ui.y;
    }

    if (page_tex.w <= canvas_w)
    {
        scroll_x = 0;
        x = canvas_x + (canvas_w - page_tex.w) / 2;
    }
    else
    {
        scroll_x = fz_clamp(scroll_x, 0, page_tex.w - canvas_w);
        x = canvas_x - scroll_x;
    }

    if (page_tex.h <= canvas_h)
    {
        scroll_y = 0;
        y = canvas_y + (canvas_h - page_tex.h) / 2;
    }
    else
    {
        scroll_y = fz_clamp(scroll_y, 0, page_tex.h - canvas_h);
        y = canvas_y - scroll_y;
    }

    ui_draw_image(&page_tex, x - page_tex.x, y - page_tex.y);

    do_forms(x, y);

    if (!search_active)
    {
        do_links(links, x, y);
        do_page_selection(x, y, x+page_tex.w, y+page_tex.h);
        if (search_hit_page == currentpage && search_hit_count > 0)
            do_search_hits(x, y);
    }
}
예제 #29
0
파일: print-editor.c 프로젝트: GYGit/gtk
static void
update_ui (void)
{
  update_title (GTK_WINDOW (main_window));
  update_statusbar ();
}
static void progress_change_box(WebKitWebView* page, gint progress, gpointer data)
{
 load_progress = progress;
 update_title(GTK_WINDOW(main_window));
}