void SpectralMeterView::reduce_bands()
{
	// check if we have to update some variables
	if ((m_spectrum.size() != (int)num_bands) 
		|| (fft_size != (uint)qMin(specl.size(), specr.size())) 
		|| ((uint)m_map_idx2freq.size() != fft_size)) {
			update_layout();
	}

	// calculate the sample weight for the average curve
	double sweight = 1.0 / (double)sample_weight;
	double oweight = 1.0 - sweight;

	// loop through the freq bands and determine the db-values
	for (int i = 0; i < m_spectrum.size(); ++i) {
		float val = freq2db(m_bands.at(i), m_bands.at(i+1));
		float hist = DB_FLOOR + (m_spectrum.at(i) - DB_FLOOR) * SMOOTH_FACTOR;
		m_spectrum[i] = qMax(val, hist);
	}

	// fill the average sample curve
	if (show_average && update_average) {
		for (int i = 0; i < m_avg_db.size(); ++i) {
			float val = 5.0 * (log10(specl.at(i) * specr.at(i)) + xfactor);
			float v = val * sweight + m_avg_db.at(i) * oweight;
			m_avg_db[i] = v;
		}

		// progress the sample weighting for the average curve
		if (sample_weight < (MAX_SAMPLES - 1)) {
			++sample_weight;
		}
	}
}
예제 #2
0
MutableNUMASpace::MutableNUMASpace(size_t alignment) : MutableSpace(alignment) {
  _lgrp_spaces = new (ResourceObj::C_HEAP, mtGC) GrowableArray<LGRPSpace*>(0, true);
  _page_size = os::vm_page_size();
  _adaptation_cycles = 0;
  _samples_count = 0;
  update_layout(true);
}
예제 #3
0
void View::on_reshape(int width, int height)
{
  glViewport(0, 0, width, height);

  output_width = width;
  output_height = height;
  update_layout();
}
예제 #4
0
void View::fix_scale_width(int width)
{
  view_sync.enter();
  scale_fixed_width = width;
  update_layout();
  view_sync.leave();
  refresh();
}
예제 #5
0
void View::set_scale_format(const char* fmt)
{
  view_sync.enter();
  strncpy(scale_fmt, fmt, 19);
  update_layout();
  view_sync.leave();
  refresh();
}
예제 #6
0
void View::show_scale(bool show)
{
  view_sync.enter();
  b_scale = show;
  if (output_id >= 0)
    update_layout();
  view_sync.leave();
  refresh();
}
예제 #7
0
void
EditorScreen::toggle_minimap()
{
  if (minimap->is_visible())
    minimap->hide();
  else
    minimap->show();

  update_layout();
}
예제 #8
0
void View::set_scale_position(int horz, int vert)
{
  view_sync.enter();
  pos_horz = horz;
  pos_vert = vert;
  if (output_id >= 0)
    update_layout();
  view_sync.leave();
  refresh();
}
예제 #9
0
void
EditorScreen::toggle_object_selector()
{
  if (object_selector->is_visible())
    object_selector->hide();
  else
    object_selector->show();

  update_layout();
}
예제 #10
0
void View::auto_min_max_range()
{
  view_sync.enter();
  range_auto = true;
  if (output_id >= 0)
    update_layout();
  view_sync.leave();

  refresh();
}
예제 #11
0
void View::set_scale_size(int width, int height, int numticks)
{
  view_sync.enter();
  scale_width = width;
  scale_height = height;
  scale_numticks = numticks;
  update_layout();
  view_sync.leave();
  refresh();
}
예제 #12
0
파일: view.cpp 프로젝트: MathPhys/hermes2d
void View::set_min_max_range(double min, double max)
{
  view_sync.enter();
  range_min = min;
  range_max = max;
  range_auto = false;
  if (output_id >= 0)
    update_layout();
  view_sync.leave();
  refresh();
}
예제 #13
0
static void
settings_changed_cb (GtkWidget *widget, gpointer user_data)
{
	StrongswanPluginUiWidget *self = STRONGSWAN_PLUGIN_UI_WIDGET (user_data);
	StrongswanPluginUiWidgetPrivate *priv = STRONGSWAN_PLUGIN_UI_WIDGET_GET_PRIVATE (self);

	if (widget == GTK_WIDGET (gtk_builder_get_object (priv->builder, "method-combo")))
	{
		update_layout(GTK_WIDGET (gtk_builder_get_object (priv->builder, "method-combo")), priv);
	}
	g_signal_emit_by_name (STRONGSWAN_PLUGIN_UI_WIDGET (user_data), "changed");
}
예제 #14
0
void
EditorScreen::resize(const Size& size_)
{
  gui_manager->set_rect(Rect(Vector2i(0, 0), size_));

  {
    Size msg_size(600, 160);
    m_level_new_msgbox->set_rect(Rect(Vector2i((Display::get_width()  - msg_size.width)/2,
                                               (Display::get_height() - msg_size.height)/2),
                                      msg_size));
  }

  update_layout();
}
예제 #15
0
void iterate()
{
  std::vector<char *> sections;
  std::vector<char *>::iterator it; 

  SescConf->getAllSections(sections) ;

  char line[100] ;
  for(it = sections.begin();it != sections.end(); it++) {
    const char *block = *it;

    if (!SescConf->checkCharPtr(block,"deviceType")) 
      continue;

    const char *name = SescConf->getCharPtr(block,"deviceType") ;

    if(strcasecmp(name,"vbus")==0){
      SescConf->updateRecord(block,"busEnergy",0.0) ; // FIXME: compute BUS energy
    }else if (strcasecmp(name,"niceCache") == 0) {
      // No energy for ideal caches (DRAM bank)
      SescConf->updateRecord(block, "RdHitEnergy"   ,0.0);
      SescConf->updateRecord(block, "RdMissEnergy"  ,0.0);
      SescConf->updateRecord(block, "WrHitEnergy"   ,0.0);
      SescConf->updateRecord(block, "WrMissEnergy"  ,0.0);
      
    }else if(strstr(name,"cache") 
             || strstr(name,"tlb")
             || strstr(name,"mem")
             || strstr(name,"dir") 
             || !strcmp(name,"revLVIDTable") ) {

      xcacti_flp xflp;
      double eng = getEnergy(block, &xflp);

#ifdef SESC_SESCTHERM2
      if (SescConf->checkCharPtr(block,"blockName")) {
        const char *blockName = SescConf->getCharPtr(block,"blockName");
        MSG("%s (block=%s) has blockName %s",name, block, blockName);
        update_layout(blockName, &xflp);
      }
#else
      // write it
      SescConf->updateRecord(block, "RdHitEnergy"   ,eng);
      SescConf->updateRecord(block, "RdMissEnergy"  ,eng * 2); // Rd miss + lineFill
      SescConf->updateRecord(block, "WrHitEnergy"   ,eng);
      SescConf->updateRecord(block, "WrMissEnergy"  ,eng * 2); // Wr miss + lineFill
#endif
    }
  }
}
예제 #16
0
void View::set_min_max_range(double min, double max)
{
  if (max < min) {
    std::swap(min, max);
    warn("Upper bound set below the lower bound: reversing to (%f,%f).", min, max);
  }
  view_sync.enter();
  range_min = min;
  range_max = max;
  range_auto = false;
  if (output_id >= 0)
    update_layout();
  view_sync.leave();
  refresh();
}
예제 #17
0
FileList::FileList(const Rect& rect_) :
  RectComponent(rect_),
  hspace(),
  vspace(),
  file_icon(),
  directory_icon(),
  m_direction(),
  directory(),
  current_item(-1),
  click_item(-1),
  page(0),
  num_pages(0),
  on_click()
{
  update_layout();
}
예제 #18
0
void VectorView::show(MeshFunction* xsln, MeshFunction* ysln, double eps, int xitem, int yitem)
{
  vec.lock_data();
  vec.process_solution(xsln, xitem, ysln, yitem, eps);
  if (range_auto) { range_min = vec.get_min_value();
                    range_max = vec.get_max_value(); }
  vec.calc_vertices_aabb(&vertices_min_x, &vertices_max_x, &vertices_min_y, &vertices_max_y);
  vec.unlock_data();

  create();
  update_layout();
  reset_view(false);

  refresh();

  wait_for_draw();
}
// is called upon closing the properties dialog
void SpectralMeterView::load_configuration()
{
	upper_freq = config().get_property("SpectralMeter", "UpperFrequenty", 22050).toInt();
	lower_freq = config().get_property("SpectralMeter", "LowerFrequenty", 20).toInt();
	num_bands = config().get_property("SpectralMeter", "NumberOfBands", 16).toInt();
	upper_db = config().get_property("SpectralMeter", "UpperdB", 0).toInt();
	lower_db = config().get_property("SpectralMeter", "LowerdB", -90).toInt();
	show_average = config().get_property("SpectralMeter", "ShowAvarage", 0).toInt();
	
	if (m_meter) {
		((SpectralMeter*)m_meter)->set_fr_size(config().get_property("SpectralMeter", "FFTSize", 2048).toInt());
		((SpectralMeter*)m_meter)->set_windowing_function(config().get_property("SpectralMeter", "WindowingFunction", 1).toInt());
		((SpectralMeter*)m_meter)->init();
	}

	update_layout();
}
예제 #20
0
파일: order_view.cpp 프로젝트: HPeX/hermes
      void OrderView::show(SpaceSharedPtr<Scalar> space, bool show_edge_orders)
      {
        if (!space->is_up_to_date())
          throw Hermes::Exceptions::Exception("The space is not up to date.");

        ord.lock_data();
        ord.process_space(space, show_edge_orders);
        ord.calc_vertices_aabb(&vertices_min_x, &vertices_max_x, &vertices_min_y, &vertices_max_y);
        init_order_palette(ord.get_vertices());
        ord.unlock_data();

        create();
        update_layout();
        reset_view(false);
        refresh();
        wait_for_draw();
      }
예제 #21
0
Value StandardObject::slot_value(Value arg)
{
  if (!symbolp(arg))
    return signal_type_error(arg, S_symbol);
  Layout * layout = this->layout();
  if (!layout)
    return signal_lisp_error("No layout for instance.");
  if (layout->is_invalid())
    {
      // Update instance.
      layout = update_layout();
    }
  Value value;
  long index = layout->slot_index(arg);
  if (index >= 0)
    {
      value = iref(index);
    }
  else
    {
      // not an instance slot
      Value location = layout->shared_slot_location(arg);
      if (location == NIL)
        {
          // slot-missing
          return current_thread()->execute(the_symbol(S_slot_missing)->function(),
                                           class_of(),
                                           make_value(this),
                                           arg,
                                           S_slot_value);
        }
      value = cdr(location);
    }
  if (value == UNBOUND_VALUE)
    {
      Thread * const thread = current_thread();
      value = thread->execute(the_symbol(S_slot_unbound)->function(),
                              class_of(),
                              make_value(this),
                              arg);
      thread->clear_values();
    }
  return value;
}
예제 #22
0
void ToolBar_Impl::on_render(Canvas &canvas, const Rect &update_rect)
{
    update_layout(canvas);

    Rect rect = toolbar->get_size();

    std::vector<ToolBarItem>::size_type index, size;
    size = items.size();
    for (index = 0; index < size; index++)
    {
        ToolBarItem &item = items[index];

        GUIThemePart part_item = part_item_normal;
        if (index == index_hot_item)
            part_item = part_item_hot;
        if (index == index_pressed_item || items[index].impl->pressed)
            part_item = part_item_pressed;

        Rect item_content = part_item.get_content_box(item.impl->position);
        part_item.render_box(canvas, item.impl->position);

        Rect icon_pos = item.impl->icon_pos;
        icon_pos.translate(item_content.left, item_content.top);

        Point pressed_offset(0,0);
        if (index == index_pressed_item)
            pressed_offset = Point(0,0); // To do: Read this from css properties or remove feature totally

        if (!item.impl->icon.is_null())
        {
            icon_pos.translate(pressed_offset);
            item.impl->icon.set_frame(item.impl->frame);
            item.impl->icon.draw(canvas, icon_pos);
        }

        //FIXME: toolbar->push_cliprect(canvas, item_content);
        //canvas.fill_rect(item_content, Colorf::gray);
        // FIXME: Added 256 as a hack .. until someone fixes this class
        part_item_normal.render_text(canvas, item.impl->text, Rect(item_content.left + item.impl->text_pos.x + pressed_offset.x, item_content.top + item.impl->text_pos.y + pressed_offset.y, item_content.right+256, item_content.bottom+256));
        //toolbar->pop_cliprect(canvas);
    }
}
예제 #23
0
void VectorView::load_data(const char* filename)
{
  //get data
  vec.load_data(filename);
  vec.lock_data();
  vec.calc_vertices_aabb(&vertices_min_x, &vertices_max_x, &vertices_min_y, &vertices_max_y);
  vec.unlock_data();

  if (range_auto) {
    range_min = vec.get_min_value();
    range_max = vec.get_max_value();
  }

  create();
  update_layout();
  reset_view(false);
  refresh();

  wait_for_draw();
}
예제 #24
0
void StandardObject::set_slot_value(Value arg1, Value arg2)
{
  if (!symbolp(arg1))
    {
      signal_type_error(arg1, S_symbol);
      return;
    }
  Layout * layout = this->layout();
  if (!layout)
    {
      signal_lisp_error("No layout for instance.");
      return;
    }
  if (layout->is_invalid())
    {
      // Update instance.
      layout = update_layout();
    }
  long index = layout->slot_index(arg1);
  if (index >= 0)
    {
      iset(index, arg2);
    }
  else
    {
      // not an instance slot
      Value location = layout->shared_slot_location(arg1);
      if (location != NIL)
        SYS_setcdr(location, arg2);
      else
        {
          // slot-missing
          current_thread()->execute(the_symbol(S_slot_missing)->function(),
                                    class_of(),
                                    make_value(this),
                                    arg1,
                                    S_setf,
                                    arg2);
        }
    }
}
예제 #25
0
void View::on_mouse_move(int x, int y)
{
  if (dragging)
  {
    trans_x += (x - mouse_x);
    trans_y += (mouse_y - y);
    refresh();
  }
  else if (scaling)
  {
    log_scale += (mouse_y - y);
    scale = pow(H2DV_SCALE_LOG_BASE, log_scale);
    trans_x = scx - objx * scale - center_x;
    trans_y = center_y - objy * scale - scy;
    refresh();
  }
  else if (scale_dragging)
  {
    int oldv = pos_vert, oldh = pos_horz;
    pos_horz = (x > output_width/2);
    pos_vert = (y < output_height/2);
    if (pos_horz != oldh || pos_vert != oldv) {
      update_layout();
      refresh();
    }
  }
  else
  {
    bool oldf = scale_focused;
    scale_focused = (x >= scale_x && x <= scale_x + scale_width &&
                     y >= scale_y && y <= scale_y + scale_height);
    if (oldf != scale_focused)
      refresh();
  }
  mouse_x = x;
  mouse_y = y;
}
예제 #26
0
RutIconButton *
rut_icon_button_new (RutContext *ctx,
                     const char *label,
                     RutIconButtonPosition label_position,
                     const char *normal_icon,
                     const char *hover_icon,
                     const char *active_icon,
                     const char *disabled_icon)
{
  RutIconButton *button = g_slice_new0 (RutIconButton);
  float natural_width, natural_height;
  static CoglBool initialized = FALSE;

  if (initialized == FALSE)
    {
      _rut_icon_button_init_type ();
      initialized = TRUE;
    }

  rut_object_init (RUT_OBJECT (button), &rut_icon_button_type);

  button->ref_count = 1;

  rut_list_init (&button->on_click_cb_list);

  rut_graphable_init (RUT_OBJECT (button));
  rut_paintable_init (RUT_OBJECT (button));

  button->ctx = ctx;

  button->state = ICON_BUTTON_STATE_NORMAL;

  button->stack = rut_stack_new (ctx, 100, 100);

  button->layout = rut_box_layout_new (ctx, RUT_BOX_LAYOUT_PACKING_TOP_TO_BOTTOM);
  rut_stack_add (button->stack, button->layout);
  rut_refable_unref (button->layout);

  button->bin = rut_bin_new (ctx);
  rut_box_layout_add (button->layout, TRUE, button->bin);
  rut_refable_unref (button->bin);

  button->label_position = label_position;

  if (label)
    {
      RutBin *bin = rut_bin_new (ctx);

      rut_bin_set_x_position (bin, RUT_BIN_POSITION_CENTER);

      button->label = rut_text_new_with_text (ctx, NULL, label);
      rut_bin_set_child (bin, button->label);

      rut_box_layout_add (button->layout, FALSE, bin);
      rut_refable_unref (bin);

      update_layout (button);
    }

  rut_icon_button_set_normal (button, normal_icon);
  rut_icon_button_set_hover (button, hover_icon);
  rut_icon_button_set_active (button, active_icon);
  rut_icon_button_set_disabled (button, disabled_icon);

  button->input_region =
    rut_input_region_new_rectangle (0, 0, 100, 100,
                                    _rut_icon_button_input_cb,
                                    button);
  rut_stack_add (button->stack, button->input_region);
  rut_refable_unref (button->input_region);

  rut_sizable_get_preferred_width (button->stack, -1, NULL,
                                   &natural_width);
  rut_sizable_get_preferred_height (button->stack, natural_width, NULL,
                                    &natural_height);
  rut_sizable_set_size (button->stack, natural_width, natural_height);

  rut_graphable_add_child (button, button->stack);

  return button;
}
예제 #27
0
void processorCore() {
  const char *proc = SescConf->getCharPtr("","cpusimu",0) ;
  fprintf(stderr,"proc = [%s]\n",proc);

  xcacti_flp xflp;

  //----------------------------------------------
  // Branch Predictor
  processBranch(proc);
  
  //----------------------------------------------
  // Register File
  int issueWidth= SescConf->getInt(proc,"issueWidth");
  int size    = SescConf->getInt(proc,"intRegs");
  int banks   = 1; 
  int rdPorts = 2*issueWidth;
  int wrPorts = issueWidth;
  int bits = 32;
  int bytes = 8;

  if(SescConf->checkInt(proc,"bits")) {
    bits = SescConf->getInt(proc,"bits");
    bytes = bits/8;
    if (bits*8 != bytes) {
      fprintf(stderr,"Not valid number of bits for the processor core [%d]\n",bits);
      exit(-2);
    }
  }

  if(SescConf->checkInt(proc,"intRegBanks"))
    banks = SescConf->getInt(proc,"intRegBanks");

  if(SescConf->checkInt(proc,"intRegRdPorts"))
    rdPorts = SescConf->getInt(proc,"intRegRdPorts");

  if(SescConf->checkInt(proc,"intRegWrPorts"))
    wrPorts = SescConf->getInt(proc,"intRegWrPorts");

  double regEnergy = getEnergy(size*bytes, bytes, 1, rdPorts, wrPorts, banks, 0, bits, &xflp);

  printf("\nRegister [%d bytes] banks[%d] ports[%d] Energy[%g]\n"
         ,size*bytes, banks, rdPorts+wrPorts, regEnergy);

#ifdef ESESC_ESESCTHERM2
  const char *blockName = SescConf->getCharPtr(proc,"IntRegBlockName");
  I(blockName);
  update_layout(blockName, &xflp);
  blockName = SescConf->getCharPtr(proc,"fpRegBlockName");
  I(blockName);
  update_layout(blockName , &xflp); // FIXME: different energy for FP register
#else
  SescConf->updateRecord(proc,"wrRegEnergy",regEnergy);
  SescConf->updateRecord(proc,"rdRegEnergy",regEnergy);
#endif


  //----------------------------------------------
  // Load/Store Queue
  size      = SescConf->getInt(proc,"maxLoads");
  banks     = 1; 
  rdPorts   = res_memport;
  wrPorts   = res_memport;

  if(SescConf->checkInt(proc,"lsqBanks"))
    banks = SescConf->getInt(proc,"lsqBanks");

  regEnergy = getEnergy(size*2*bytes,2*bytes,size,rdPorts,wrPorts,banks,1, 2*bits, &xflp);
#ifdef ESESC_ESESCTHERM2
  // FIXME: partition energies per structure
  blockName = SescConf->getCharPtr(proc,"LSQBlockName");
  I(blockName);
  update_layout(lsqBlockName, &xflp);
#else
  SescConf->updateRecord(proc,"ldqRdWrEnergy",regEnergy);
#endif
  printf("\nLoad Queue [%d bytes] banks[%d] ports[%d] Energy[%g]\n"
         ,size*2*bytes, banks, 2*res_memport, regEnergy);

  size      =  SescConf->getInt(proc,"maxStores");
 
  regEnergy = getEnergy(size*4*bytes,4*bytes,size,rdPorts,wrPorts,banks,1, 2*bits, &xflp);
#ifdef ESESC_ESESCTHERM2
  // FIXME: partition energies per structure
  blockName = SescConf->getCharPtr(proc,"LSQBlockName");
  I(blockName);
  update_layout(lsqBlockName, &xflp);
#else
  SescConf->updateRecord(proc,"stqRdWrEnergy",regEnergy);
#endif
  printf("\nStore Queue [%d bytes] banks[%d] ports[%d] Energy[%g]\n"
         ,size*4*bytes, banks, 2*res_memport, regEnergy);


#ifdef ESESC_INORDER 
  size      =  size/4;
 
  regEnergy = getEnergy(size*4*bytes,4*bytes,size,rdPorts,wrPorts,banks,1, 2*bits, &xflp);

  printf("\nStore Inorder Queue [%d bytes] banks[%d] ports[%d] Energy[%g]\n"
         ,size*4*bytes, banks, 2*res_memport, regEnergy);

  SescConf->updateRecord(proc,"stqRdWrEnergyInOrder",regEnergy);

#ifdef ESESC_ESESCTHERM
  I(0);
  exit(-1); // Not supported
#endif

 #endif 
 
  //----------------------------------------------
  // Reorder Buffer
  size      = SescConf->getInt(proc,"robSize");
  banks     = size/64;
  if (banks == 0) {
    banks = 1;
  }else{
    banks = roundUpPower2(banks);
  }
  
  // Retirement should hit another bank
  rdPorts   = 1; // continuous possitions
  wrPorts   = 1;

  regEnergy = getEnergy(size*2,2*issueWidth,1,rdPorts,wrPorts,banks,0,16*issueWidth, &xflp);
#ifdef ESESC_ESESCTHERM2
  const char *blockName = SescConf->getCharPtr(proc,"robBlockName");
  I(blockName);
  update_layout(blockName, &xflp);
  // FIXME: partition energies per structure
#else
  SescConf->updateRecord(proc,"robEnergy",regEnergy);
#endif

  printf("\nROB [%d bytes] banks[%d] ports[%d] Energy[%g]\n",size*2, banks, 2*rdPorts, regEnergy);

  //----------------------------------------------
  // Rename Table
  {
    double bitsPerEntry = log((double)SescConf->getInt(proc,"intRegs"))/log((double)2);
    
    size      = roundUpPower2(static_cast<unsigned int>(32*bitsPerEntry/8));
    banks     = 1;
    rdPorts   = 2*issueWidth;
    wrPorts   = issueWidth;

    regEnergy = getEnergy(size,1,1,rdPorts,wrPorts,banks,0,1, &xflp);
#ifdef ESESC_ESESCTHERM2
    update_layout("IntRAT", &xflp); //FIXME: create a IntRATblockName
    // FIXME: partition energies per structure
#endif

    printf("\nrename [%d bytes] banks[%d] Energy[%g]\n",size, banks, regEnergy);

    regEnergy += getEnergy(size,1,1,rdPorts/2+1,wrPorts/2+1,banks,0,1, &xflp);
#ifdef ESESC_ESESCTHERM2
    update_layout("IntRAT", &xflp);
    // FIXME: partition energies per structure
#else
    // unified FP+Int RAT energy counter
    SescConf->updateRecord(proc,"renameEnergy",regEnergy);
#endif
  }

  //----------------------------------------------
  // Window Energy & Window + DDIS

  {
    int min = SescConf->getRecordMin(proc,"cluster") ;
    int max = SescConf->getRecordMax(proc,"cluster") ;
    I(min==0);

    for(int i = min ; i <= max ; i++) {
      const char *cluster = SescConf->getCharPtr(proc,"cluster",i) ;

      // TRADITIONAL COLLAPSING ISSUE LOGIC
      // Recalculate windowRdWrEnergy using CACTI (keep select and wake)
      
      size      = SescConf->getInt(cluster,"winSize");
      banks     = 1;
      rdPorts   = SescConf->getInt(cluster,"wakeUpNumPorts");
      wrPorts   = issueWidth;
      int robSize          = SescConf->getInt(proc,"robSize");
      float entryBits = 4*(log((double )robSize)/log((double)2)); // src1, src2, dest, instID
      entryBits += 7; // opcode
      entryBits += 1; // ready bit
      
      int tableBits = static_cast<int>(entryBits * size);
      int tableBytes;
      if (tableBits < 8) {
	tableBits  = 8;
	tableBytes = 1;
      }else{
	tableBytes = tableBits/8;
      }
      int assoc= roundUpPower2(static_cast<unsigned int>(entryBits/8));
      tableBytes = roundUpPower2(tableBytes);
      regEnergy = getEnergy(tableBytes,tableBytes/assoc,assoc,rdPorts,wrPorts,banks,1,static_cast<int>(entryBits), &xflp);
      
      printf("\nWindow [%d bytes] assoc[%d] banks[%d] ports[%d] Energy[%g]\n"
	     ,tableBytes, assoc, banks, rdPorts+wrPorts, regEnergy);
      
#ifdef ESESC_ESESCTHERM2
      const char *blockName = SescConf->getCharPtr(cluster,"blockName");
      I(blockName);
      update_layout(blockName, &xflp);
#else
      // unified FP+Int RAT energy counter
      SescConf->updateRecord(cluster,"windowRdWrEnergy" ,regEnergy,0);
#endif
    }
  }
}
예제 #28
0
static gboolean
init_plugin_ui (StrongswanPluginUiWidget *self, NMConnection *connection, GError **error)
{
	StrongswanPluginUiWidgetPrivate *priv = STRONGSWAN_PLUGIN_UI_WIDGET_GET_PRIVATE (self);
	NMSettingVPN *settings;
	GtkWidget *widget;
	const char *value;

	settings = NM_SETTING_VPN(nm_connection_get_setting(connection, NM_TYPE_SETTING_VPN));
	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "address-entry"));
	value = nm_setting_vpn_get_data_item (settings, "address");
	if (value)
		gtk_entry_set_text (GTK_ENTRY (widget), value);
	g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (settings_changed_cb), self);

	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "certificate-button"));
	value = nm_setting_vpn_get_data_item (settings, "certificate");
	if (value)
		gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value);
	g_signal_connect (G_OBJECT (widget), "selection-changed", G_CALLBACK (settings_changed_cb), self);

	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "user-label"));
	gtk_widget_set_no_show_all (widget, TRUE);
	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "user-entry"));
	gtk_widget_set_no_show_all (widget, TRUE);
	value = nm_setting_vpn_get_data_item (settings, "user");
	if (value)
		gtk_entry_set_text (GTK_ENTRY (widget), value);
	g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (settings_changed_cb), self);

	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "method-combo"));
	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), _("Certificate/private key"));
	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), _("Certificate/ssh-agent"));
	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), _("Smartcard"));
	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), _("EAP"));
	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), _("Pre-shared key"));
	value = nm_setting_vpn_get_data_item (settings, "method");
	if (value) {
		if (g_strcmp0 (value, "key") == 0) {
			gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
		}
		if (g_strcmp0 (value, "agent") == 0) {
			gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 1);
		}
		if (g_strcmp0 (value, "smartcard") == 0) {
			gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 2);
		}
		if (g_strcmp0 (value, "eap") == 0) {
			gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 3);
		}
		if (g_strcmp0 (value, "psk") == 0) {
			gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 4);
		}
	}
	if (gtk_combo_box_get_active (GTK_COMBO_BOX (widget)) == -1)
	{
		gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
	}
	update_layout (widget, priv);
	g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (settings_changed_cb), self);

	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "usercert-label"));
	gtk_widget_set_no_show_all (widget, TRUE);
	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "usercert-button"));
	gtk_widget_set_no_show_all (widget, TRUE);
	value = nm_setting_vpn_get_data_item (settings, "usercert");
	if (value)
		gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value);
	g_signal_connect (G_OBJECT (widget), "selection-changed", G_CALLBACK (settings_changed_cb), self);

	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "userkey-label"));
	gtk_widget_set_no_show_all (widget, TRUE);
	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "userkey-button"));
	gtk_widget_set_no_show_all (widget, TRUE);
	value = nm_setting_vpn_get_data_item (settings, "userkey");
	if (value)
		gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), value);
	g_signal_connect (G_OBJECT (widget), "selection-changed", G_CALLBACK (settings_changed_cb), self);

	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "virtual-check"));
	value = nm_setting_vpn_get_data_item (settings, "virtual");
	if (value && strcmp(value, "yes") == 0)
	{
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
	}
	g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (settings_changed_cb), self);

	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "encap-check"));
	value = nm_setting_vpn_get_data_item (settings, "encap");
	if (value && strcmp(value, "yes") == 0)
	{
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
	}
	g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (settings_changed_cb), self);

	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "ipcomp-check"));
	value = nm_setting_vpn_get_data_item (settings, "ipcomp");
	if (value && strcmp(value, "yes") == 0)
	{
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
	}
	g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (settings_changed_cb), self);

	return TRUE;
}
예제 #29
0
// Default constructor
EditorScreen::EditorScreen() :
  plf(new EditorLevel()),
  level_pathname(),
  panel(0),
  viewport(0),
  object_selector(0),
  minimap(),
  object_properties(),
  action_properties(),
  level_properties(),
  file_load_dialog(),
  file_save_dialog(),
  m_level_new_msgbox(),
  show_help(false)
{
  // Create the viewport for the images and data
  viewport = new Viewport(this, Rect(0, 38,
                                     size.width - 244,
                                     size.height));
  gui_manager->add(viewport);

  // Create the panel for the buttons
  panel = new Panel(this);

  //rect(Vector2i(Display::get_width() - 244 + 2,  38 + 3 + 62),
  //      Size(240, Display::get_height() - (600 - 495))),

  minimap = new Minimap(this, Rect());
  gui_manager->add(minimap);

  object_properties = gui_manager->create<ObjectProperties>(this, Rect(Vector2i(), Size(200, 150)));

  action_properties = gui_manager->create<ActionProperties>(this, Rect());
  action_properties->hide();

  level_properties = gui_manager->create<LevelProperties>(this, Rect());
  level_properties->hide();
  level_properties->set_level(plf.get());
  action_properties->set_level(plf.get());

  object_selector = gui_manager->create<ObjectSelector>(this, Rect());

  file_load_dialog = gui_manager->create<FileDialog>(this, Rect(Vector2i(50, 50),
                                                                Size(size.width  - 100,
                                                                     size.height - 100)),
                                                     FileDialog::LOAD);
  file_load_dialog->hide();

  file_save_dialog = gui_manager->create<FileDialog>(this, Rect(Vector2i(50, 50),
                                                                Size(Display::get_width() - 100,
                                                                     Display::get_height() - 100)),
                                                     FileDialog::SAVE);
  file_save_dialog->hide();

  {
    Size msg_size(600, 160);

    m_level_new_msgbox = gui_manager->create<MessageBox>(Rect(Vector2i((Display::get_width() - msg_size.width)/2,
                                                                       (Display::get_height() - msg_size.height)/2),
                                                              msg_size));
    m_level_new_msgbox->set_title("Create new level");
    m_level_new_msgbox->set_text("Replace current level with an empty new one?");
    m_level_new_msgbox->set_ok_text("Replace");
    m_level_new_msgbox->on_ok.connect(std::bind(&EditorScreen::level_new_without_confirm, this));

    m_level_new_msgbox->hide();
  }

  viewport->selection_changed.connect(std::bind(&ObjectProperties::set_objects, object_properties, std::placeholders::_1));
  viewport->refresh();

  update_layout();
}
예제 #30
0
 void set_rect(const Rect& rect_) 
 {
   rect = rect_;
   update_layout();
 }