예제 #1
0
			BufferPage AllocatePage()override
			{
				BufferPage page = PopFreePage();
				if (page.index == -1)
				{
					return AppendPage();
				}
				else
				{
					SetUseMask(page, true);
					return page;
				}
			}
예제 #2
0
			void SetUseMask(BufferPage page, bool available)
			{
				auto useMaskPageBits = 8 * sizeof(vuint64_t);
				auto useMaskPageIndex = page.index / (useMaskPageBits * useMaskPageItemCount);
				auto useMaskPageBitIndex = page.index % (useMaskPageBits * useMaskPageItemCount);
				auto useMaskPageItem = INDEX_USEMASK_USEMASKBEGIN + useMaskPageBitIndex / useMaskPageBits;
				auto useMaskPageShift = useMaskPageBitIndex % useMaskPageBits;
				bool newPage = false;

				BufferPage useMaskPage = BufferPage::Invalid();

				if (useMaskPageIndex == useMaskPages.Count())
				{
					newPage = true;
					BufferPage lastPage{useMaskPages[useMaskPageIndex - 1]};
					useMaskPage = AppendPage();
					useMaskPages.Add(useMaskPage.index);

					auto pageDesc = MapPage(lastPage);
					vuint64_t* numbers = (vuint64_t*)pageDesc->address;
					numbers[INDEX_USEMASK_NEXTUSEMASKPAGE] = useMaskPage.index;
					msync(numbers, pageSize, MS_SYNC);
				}
				else
				{
					useMaskPage.index = useMaskPages[useMaskPageIndex];
				}

				auto pageDesc = MapPage(useMaskPage);
				vuint64_t* numbers = (vuint64_t*)pageDesc->address;
				if (newPage)
				{
					numbers[INDEX_USEMASK_NEXTUSEMASKPAGE] = INDEX_INVALID;
				}

				auto& item = numbers[useMaskPageItem];
				if (available)
				{
					vuint64_t mask = ((vuint64_t)1) << useMaskPageShift;
					item |= mask;
				}
				else
				{
					vuint64_t mask = ~(((vuint64_t)1) << useMaskPageShift);
					item &= mask;
				}
				msync(numbers, pageSize, MS_SYNC);
			}
예제 #3
0
파일: GTKTabBar.cpp 프로젝트: DX-MON/GTKpp
void GTKTabBar::AppendPage(GTKWidget *Child, const char *Label)
{
	GTKWidget *label = new GTKLabel(Label);
	AppendPage(Child, label);
}
예제 #4
0
MeasurePanel::MeasurePanel(const QString &title,
                           QWidget *parent,
                           TraceManager *trace_manager,
                           const SweepSettings *sweep_settings) :
    DockPanel(title, parent),
    trace_manager_ptr(trace_manager),
    settings_ptr(sweep_settings)
{
    DockPage *trace_page = new DockPage("Traces");
    DockPage *marker_page = new DockPage("Markers");
    DockPage *offset_page = new DockPage("Offsets");
    channel_power_page = new DockPage("Channel Power");
    occupied_bandwidth_page = new DockPage("Occupied Bandwidth");

    QStringList string_list;

    trace_select = new ComboEntry("Trace");
    trace_type = new ComboEntry("Type");
    trace_avg_count = new NumericEntry("Avg Count", 10, "");
    trace_color = new ColorEntry("Color");
    //trace_active = new CheckBoxEntry("Active");
    trace_updating = new CheckBoxEntry("Update");
    export_clear = new DualButtonEntry("Export", "Clear");

    string_list << "One" << "Two" << "Three" << "Four" << "Five" << "Six";
    trace_select->setComboText(string_list);
    string_list.clear();

    // Must match TraceType enum list
    string_list << "Off" << "Clear & Write" << "Max Hold" << "Min Hold" <<
                   "Min/Max Hold" << "Average";
    trace_type->setComboText(string_list);
    string_list.clear();

    trace_page->AddWidget(trace_select);
    trace_page->AddWidget(trace_type);
    trace_page->AddWidget(trace_avg_count);
    trace_page->AddWidget(trace_color);
    trace_page->AddWidget(trace_updating);
    trace_page->AddWidget(export_clear);

    AppendPage(trace_page);

    connect(trace_select, SIGNAL(comboIndexChanged(int)),
            this, SLOT(updateTraceView(int)));
    connect(trace_type, SIGNAL(comboIndexChanged(int)),
            trace_manager_ptr, SLOT(setType(int)));
    connect(trace_avg_count, SIGNAL(valueChanged(double)),
            trace_manager_ptr, SLOT(setAvgCount(double)));
    connect(trace_color, SIGNAL(colorChanged(QColor&)),
            trace_manager_ptr, SLOT(setColor(QColor&)));
    connect(trace_updating, SIGNAL(clicked(bool)),
            trace_manager_ptr, SLOT(setUpdate(bool)));

    connect(export_clear, SIGNAL(leftPressed()),
            trace_manager_ptr, SLOT(exportTrace()));
    connect(export_clear, SIGNAL(rightPressed()),
            trace_manager_ptr, SLOT(clearTrace()));

    // Marker stuff
    marker_select = new ComboEntry("Marker");
    on_trace_select = new ComboEntry("Place On");
    setMarkerFreq = new FrequencyEntry("Set Freq", 1.0e6);
    marker_update = new CheckBoxEntry("Update");
    marker_active = new CheckBoxEntry("Active");
    peak_delta = new DualButtonEntry("Peak Search", "Delta");
    to_center_ref = new DualButtonEntry("To Center", "To Ref");
    peak_left_right = new DualButtonEntry("Peak Left", "Peak Right");

    string_list << "One" << "Two" << "Three" << "Four" << "Five" << "Six";
    marker_select->setComboText(string_list);
    string_list.clear();
    string_list << "Trace One" << "Trace Two" << "Trace Three"
                << "Trace Four" << "Trace Five" << "Trace Six";
    on_trace_select->setComboText(string_list);
    string_list.clear();

    marker_page->AddWidget(marker_select);
    marker_page->AddWidget(on_trace_select);
    marker_page->AddWidget(setMarkerFreq);
    marker_page->AddWidget(marker_update);
    marker_page->AddWidget(marker_active);
    marker_page->AddWidget(peak_delta);
    marker_page->AddWidget(to_center_ref);
    marker_page->AddWidget(peak_left_right);

    AppendPage(marker_page);

    connect(marker_select, SIGNAL(comboIndexChanged(int)),
            this, SLOT(updateMarkerView(int)));
    connect(on_trace_select, SIGNAL(comboIndexChanged(int)),
            trace_manager_ptr, SLOT(setMarkerOnTrace(int)));
    connect(setMarkerFreq, SIGNAL(freqViewChanged(Frequency)),
            this, SLOT(setMarkerFrequencyChanged(Frequency)));
    connect(marker_update, SIGNAL(clicked(bool)),
            trace_manager_ptr, SLOT(markerUpdate(bool)));
    connect(marker_active, SIGNAL(clicked(bool)),
            trace_manager_ptr, SLOT(markerActive(bool)));
    connect(peak_delta, SIGNAL(leftPressed()),
            trace_manager_ptr, SLOT(markerPeakSearch()));
    connect(peak_delta, SIGNAL(rightPressed()),
            trace_manager_ptr, SLOT(markerDeltaClicked()));
    connect(to_center_ref, SIGNAL(leftPressed()),
            trace_manager_ptr, SLOT(markerToCenter()));
    connect(to_center_ref, SIGNAL(rightPressed()),
            trace_manager_ptr, SLOT(markerToRef()));
    connect(peak_left_right, SIGNAL(leftPressed()),
            trace_manager_ptr, SLOT(markerPeakLeft()));
    connect(peak_left_right, SIGNAL(rightPressed()),
            trace_manager_ptr, SLOT(markerPeakRight()));

    ref_offset = new NumericEntry("Ref Offset",
                                  trace_manager_ptr->RefOffset(),
                                  "dB");

    offset_page->AddWidget(ref_offset);

    AppendPage(offset_page);

    connect(ref_offset, SIGNAL(valueChanged(double)),
            trace_manager_ptr, SLOT(setRefOffset(double)));

    channel_width = new FrequencyEntry("Width",
                                       20.0e6);
    channel_spacing = new FrequencyEntry("Spacing", 20.0e6);
    channel_power_enabled = new CheckBoxEntry("Enabled");

    channel_power_page->AddWidget(channel_width);
    channel_power_page->AddWidget(channel_spacing);
    channel_power_page->AddWidget(channel_power_enabled);

    AppendPage(channel_power_page);

    connect(channel_width, SIGNAL(freqViewChanged(Frequency)),
            this, SLOT(channelPowerUpdated()));
    connect(channel_spacing, SIGNAL(freqViewChanged(Frequency)),
            this, SLOT(channelPowerUpdated()));
    connect(channel_power_enabled, SIGNAL(clicked(bool)),
            this, SLOT(channelPowerUpdated()));

    ocbw_enabled = new CheckBoxEntry("Enabled");
    percentPower = new NumericEntry("% Power", 0.0, "");
    percentPower->SetValue(99.0);

    occupied_bandwidth_page->AddWidget(ocbw_enabled);
    occupied_bandwidth_page->AddWidget(percentPower);

    AppendPage(occupied_bandwidth_page);

    connect(ocbw_enabled, SIGNAL(clicked(bool)), SLOT(occupiedBandwidthUpdated()));
    connect(percentPower, SIGNAL(valueChanged(double)), SLOT(occupiedBandwidthUpdated()));

    // Done connected DockPages to TraceManager
    updateTraceView(0);
    updateMarkerView(0);

    // Miscellaneous connects
    connect(trace_manager_ptr, SIGNAL(updated()),
            this, SLOT(updateTraceView()));
    connect(trace_manager_ptr, SIGNAL(updated()),
            this, SLOT(updateMarkerView()));
}