void execute() override {
    TColumnSelection *selection =
        dynamic_cast<TColumnSelection *>(TSelection::getCurrent());

    std::set<int> indices =
        selection ? selection->getIndices() : std::set<int>();

    if (indices.empty()) {
      DVGui::warning(
          tr("It is not possible to execute the merge column command because "
             "no column was selected."));
      return;
    }

    if (indices.size() == 1) {
      DVGui::warning(
          tr("It is not possible to execute the merge column command  because "
             "only one columns is  selected."));
      return;
    }

    mergeColumns(indices);
    TApp::instance()->getCurrentXsheet()->notifyXsheetChanged();
  }
Exemple #2
0
static void filter(gambatte::uint_least32_t *dline,
                   std::ptrdiff_t const pitch,
                   gambatte::uint_least32_t const *sline)
{
	Colorsum sums[in_pitch];
	for (unsigned h = in_height; h--;) {
		{
			gambatte::uint_least32_t const *s = sline;
			Colorsum *sum = sums;
			unsigned n = in_pitch;
			while (n--) {
				unsigned long pixel = *s;
				sum->r = pixel >> 12 & 0x000FF0 ;
				pixel <<= 4;
				sum->g = pixel & 0x0FF000;
				sum->b = pixel & 0x000FF0;

				++s;
				++sum;
			}
		}

		mergeColumns(dline, sums);
		dline += pitch;

		{
			gambatte::uint_least32_t const *s = sline;
			Colorsum *sum = sums;
			unsigned n = in_pitch;
			while (n--) {
				unsigned long pixel = *s;
				unsigned long rsum = (pixel >> 16) * 9;
				unsigned long gsum = (pixel & 0x00FF00) * 9;
				unsigned long bsum = (pixel & 0x0000FF) * 9;

				pixel = s[-1 * in_pitch];
				rsum -= pixel >> 16;
				gsum -= pixel & 0x00FF00;
				bsum -= pixel & 0x0000FF;

				pixel = s[1 * in_pitch];
				rsum += (pixel >> 16) * 9;
				gsum += (pixel & 0x00FF00) * 9;
				bsum += (pixel & 0x0000FF) * 9;

				pixel = s[2 * in_pitch];
				rsum -= pixel >> 16;
				gsum -= pixel & 0x00FF00;
				bsum -= pixel & 0x0000FF;

				sum->r = rsum;
				sum->g = gsum;
				sum->b = bsum;

				++s;
				++sum;
			}
		}

		mergeColumns(dline, sums);
		dline += pitch;
		sline += in_pitch;
	}
}