void get_simple_chatarea(t_chatarea* args) { args->ca_vbox = get_new_box(&args->ca_box_args); args->ca_topbox_args.box_parent.par_parent = args->ca_vbox; args->ca_topbox = get_new_box(&args->ca_topbox_args); args->ca_tv_args.tv_parent.par_parent = args->ca_topbox; args->ca_textarea = get_new_textview_scrolled(&args->ca_tv_args, &args->ca_scroll); args->ca_trv_args.trv_parent.par_parent = args->ca_topbox; args->ca_treeview = get_new_treeview(&args->ca_trv_args); args->ca_botbox_args.box_parent.par_parent = args->ca_vbox; args->ca_botbox = get_new_box(&args->ca_botbox_args); args->ca_ent_args.ent_parent.par_parent = args->ca_botbox; args->ca_entry = get_new_entry(&args->ca_ent_args); args->ca_but_args.but_parent.par_parent = args->ca_botbox; args->ca_button = get_new_button(&args->ca_but_args); }
static inline void apply(Box const& box, InputCollection const& collection, index_vector_type const& input, std::size_t level, std::size_t min_elements, Policy& policy, VisitBoxPolicy& box_policy) { box_policy.apply(box, level); Box lower_box, upper_box; divide_box<Dimension>(box, lower_box, upper_box); index_vector_type lower, upper, exceeding; divide_into_subsets<OverlapsPolicy>(lower_box, upper_box, collection, input, lower, upper, exceeding); if (boost::size(exceeding) > 0) { // Get the box of exceeding-only Box exceeding_box = get_new_box(collection, exceeding); // Recursively do exceeding elements only, in next dimension they // will probably be less exceeding within the new box next_level(exceeding_box, collection, exceeding, level, min_elements, policy, box_policy); // Switch to two collections, combine exceeding with lower resp upper // but not lower/lower, upper/upper next_level2(exceeding_box, collection, exceeding, lower, level, min_elements, policy, box_policy); next_level2(exceeding_box, collection, exceeding, upper, level, min_elements, policy, box_policy); } // Recursively call operation both parts next_level(lower_box, collection, lower, level, min_elements, policy, box_policy); next_level(upper_box, collection, upper, level, min_elements, policy, box_policy); }
static inline void apply(Box const& box, InputCollection1 const& collection1, index_vector_type const& input1, InputCollection2 const& collection2, index_vector_type const& input2, std::size_t level, std::size_t min_elements, Policy& policy, VisitBoxPolicy& box_policy) { box_policy.apply(box, level); Box lower_box, upper_box; divide_box<Dimension>(box, lower_box, upper_box); index_vector_type lower1, upper1, exceeding1; index_vector_type lower2, upper2, exceeding2; divide_into_subsets<OverlapsPolicy1>(lower_box, upper_box, collection1, input1, lower1, upper1, exceeding1); divide_into_subsets<OverlapsPolicy2>(lower_box, upper_box, collection2, input2, lower2, upper2, exceeding2); if (boost::size(exceeding1) > 0) { // All exceeding from 1 with 2: if (recurse_ok(exceeding1, exceeding2, min_elements, level)) { Box exceeding_box = get_new_box(collection1, exceeding1, collection2, exceeding2); next_level(exceeding_box, collection1, exceeding1, collection2, exceeding2, level, min_elements, policy, box_policy); } else { handle_two(collection1, exceeding1, collection2, exceeding2, policy); } // All exceeding from 1 with lower and upper of 2: // (Check sizes of all three collections to avoid recurse into // the same combinations again and again) if (recurse_ok(lower2, upper2, exceeding1, min_elements, level)) { Box exceeding_box = get_new_box<ExpandPolicy1>(collection1, exceeding1); next_level(exceeding_box, collection1, exceeding1, collection2, lower2, level, min_elements, policy, box_policy); next_level(exceeding_box, collection1, exceeding1, collection2, upper2, level, min_elements, policy, box_policy); } else { handle_two(collection1, exceeding1, collection2, lower2, policy); handle_two(collection1, exceeding1, collection2, upper2, policy); } } if (boost::size(exceeding2) > 0) { // All exceeding from 2 with lower and upper of 1: if (recurse_ok(lower1, upper1, exceeding2, min_elements, level)) { Box exceeding_box = get_new_box<ExpandPolicy2>(collection2, exceeding2); next_level(exceeding_box, collection1, lower1, collection2, exceeding2, level, min_elements, policy, box_policy); next_level(exceeding_box, collection1, upper1, collection2, exceeding2, level, min_elements, policy, box_policy); } else { handle_two(collection1, lower1, collection2, exceeding2, policy); handle_two(collection1, upper1, collection2, exceeding2, policy); } } if (recurse_ok(lower1, lower2, min_elements, level)) { next_level(lower_box, collection1, lower1, collection2, lower2, level, min_elements, policy, box_policy); } else { handle_two(collection1, lower1, collection2, lower2, policy); } if (recurse_ok(upper1, upper2, min_elements, level)) { next_level(upper_box, collection1, upper1, collection2, upper2, level, min_elements, policy, box_policy); } else { handle_two(collection1, upper1, collection2, upper2, policy); } }