Пример #1
0
//--------------------------------------------------------------
mainApp::mainApp(int argc, char * argv[]):
  previousEmotionReset(ofGetElapsedTimef()){
  // Set up the arguments
  po::options_description desc;
  layout_add_options(desc);
  twitter_add_options(desc);
  eeg_add_options(desc);
  expression_add_options(desc);
  desc.add_options()
    ("data", po::value<std::string>(),
     "the ABSOLUTE path to the data directory")
    ("debug",
     "use the first emotion and first 10 frames only, for debugging");

  // Parse the arguments
  po::variables_map vm;
  po::store(po::parse_command_line(argc, argv, desc), vm);
  po::notify(vm);

  // Make sure we have the data path
  if(vm.count("data") && (vm["data"].as<std::string>()[0] == '/')){
    this->data_path = vm["data"].as<std::string>();
  }else{
    throw runtime_error("Please specify --data /absolute/path/to/data/dir");
  }

  debugging = vm.count("debug");

  layout_initialize(vm, ofGetScreenWidth(), ofGetScreenHeight());
  twitter_initialize(vm);
  eeg_initialize(vm);
  expression_initialize(vm);
}
Пример #2
0
LRESULT editorctl_on_size (EDITORCTL *editorctl, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    if (editorctl->editor.layout.wrap > 0)
    {
        int new_wrap;
        RECT r;

        if (!GetClientRect (editorctl->hwnd, &r)) goto error;
        new_wrap = (r.right - r.left - editorctl->cell_size.cx - 1) / editorctl->cell_size.cx;
        if (new_wrap < 20) new_wrap = 20;
        if (editorctl->editor.layout.wrap != new_wrap)
        {
            if (!layout_destroy (&editorctl->editor.layout)) goto error;
            if (!layout_initialize (&editorctl->editor.layout, editorctl->heap, &editorctl->editor.text, 8, new_wrap, new_wrap - 10)) goto error;
            if (!editorctl_update_caret (editorctl, TRUE)) goto error;
            if (!InvalidateRect (editorctl->hwnd, &r, FALSE)) goto error;
        }

    }

    if (!editorctl_update_scroll_range (editorctl)) goto error;

    return 0;
error:
    return -1;
}
Пример #3
0
void grid::request_placement(dispatcher&, const event::ui_event, bool& handled, bool&)
{
	if (get_window()->invalidate_layout_blocked()) {
		handled = true;
		return;
	}

	point size = get_size();
	point best_size = calculate_best_size();
	if(size.x >= best_size.x && size.y >= best_size.y) {
		place(get_origin(), size);
		handled = true;
		return;
	}

	recalculate_best_size();

	if(size.y >= best_size.y) {
		// We have enough space in the Y direction, but not in the X direction.
		// Try wrapping the content.
		request_reduce_width(size.x);
		best_size = get_best_size();

		if(size.x >= best_size.x && size.y >= best_size.y) {
			// Wrapping succeeded, we still fit vertically.
			place(get_origin(), size);
			handled = true;
			return;
		} else {
			// Wrapping failed, we no longer fit.
			// Reset the sizes of child widgets.
			layout_initialize(true);
		}
	}

	/*
	Not enough space.
	Let the event flow higher up.
	This is a pre-event handler, so the event flows upwards. */
}